We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Programatically Highlight & Move to a Grid Row

Thread ID:

Created:

Updated:

Platform:

Replies:

16010 Jul 2,2004 06:44 AM Jul 2,2004 08:59 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 2, 2004 06:44 AM

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)

Administrator [Syncfusion]
Replied On July 2, 2004 08: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))

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;