Hi All,
I have a win grid with a max of 5000 rows at any given point of time. So the user will select a row on the grid and hit on the tool bar which invokes a winform. when the user x out of the form, the grid will be refresh automatically by getting a datasource from sql. But after the refresh I want the same row to be highlighted/selected and if the row # is say 4999, i want the scroll bar to navigate to that row automatically, so that the row is right now visible. Can we achieve this? This makes the user's life easy.
And by the way the grid has a column which is like primary key.
Thanks in advance.
Swetha.
Hi Swetha,
Once you set the grid's DataSource, any existing rows in the grid are destroyed and a whole new set of rows are created for the new data. So you cannot store the row and re-select it.
What you would have to do is store some information from that row like a primary key value. Then you would have to loop through the grid rows to find the row you want and make it the ActiveRow.
Mike,
You are right. Is there any efficient way that you suggest?
Do you think after binding the data source to the grid and looping through the rows to find the PK value in a grid having 5000 rows is efficient?
Or should I use Initialize Row to get the Row Index and then later actiivate the row?
Thanks!