Forum Discussion
sbkeenan
12 years agoFrequent Contributor
Hi Mina
I’m not sure if you have resolved your problem – if not, you might find that the grid control has a ‘FindRow’ method built-in. We use Developer Express grids in our application and I can use the FindRow function supplied. If you have such a method, you should be able to write something like:
The above is based on your previously supplied code, but uses the built-in FindRow method, so there is no need to call a separate user-defined function in your code. The only other recommendation I would make is that rather than specifying the column index, you can use the column heading. I find that this serves two very useful purposes:
Hope you find this helpful.
Regards
Stephen.
I’m not sure if you have resolved your problem – if not, you might find that the grid control has a ‘FindRow’ method built-in. We use Developer Express grids in our application and I can use the FindRow function supplied. If you have such a method, you should be able to write something like:
var bankingWinUI = Aliases.BankingWinUI;
var tableLayoutPanel = bankingWinUI.frmUserSearch.tableLayoutPanel1;
var grid =tableLayoutPanel.entityDataGridView1.dgvMain;
var Driver = DDT.ExcelDriver("C:\\Add-Modireyate-Gorohha.xls", "Sheet1");
var rowIndex = grid.FindRow (3, Driver.Value(0));
DDT.CloseDriver(Driver.Name);
if (rowIndex >= 0)
grid.ClickCell (rowIndex, "F'E");
else
Log.Error("Row was not found.");
The above is based on your previously supplied code, but uses the built-in FindRow method, so there is no need to call a separate user-defined function in your code. The only other recommendation I would make is that rather than specifying the column index, you can use the column heading. I find that this serves two very useful purposes:
Sometimes grid columns are hidden from the end user so what looks like column 3 may actually be column 5!!
Using the column heading makes the code that much easier to follow and eliminates the need for commenting the fact that column 3 represents the <column name here> column.
Hope you find this helpful.
Regards
Stephen.