The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi
I have a DBG bound to a dataset. I have a column in my grid called "barcode" and I have a event which collects the input of a barcode scanner. I would like to somehow highlight and scroll to the row (if the item if scrolled down the page) which matches my scanned barcode.
I can loop through the dataset column easily enough but I dont know how to highlight the row based on its databinding position (in case the grid has been sorted). Could you point me in the right direction?
Thanks Mark (vb.net)
ADAdministrator Syncfusion Team July 2, 2004 07:59 AM
>>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))