AD
Administrator
Syncfusion Team
July 2, 2004 12:59 PM UTC
>>I can loop through the dataset column easily enough
If you are working with sorts, then looping through the DataSet column will not be very useful. Instead, you should loop through the list in the CurrencyManager as this will reflect the sort, and the position you find in that list will map to the position of that row in the grid.
You can use this code to get the DataView associated with the sorted table.
Dim cm as Currencymanager = CType(Me.BindingContext(me.Grid.DataSource, me.Grid.DataMember), CurrencyManager)
dim dv as DataView = CType(cm.List, DataView)
Then you can loop through the DataView to find the position of the barcode. Then to get the grid rowindex and select the row, you can use code like
Dim rowIndex as integer = me.grid.Binder.PositionToRowIndex(position)
me.grid.ScrollCellInView(rowIndex, 1)
me.grid.Selections.Add(GridRangeInfo.Row(rowIndex))