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. Image for the cookie policy date

GridListControl: Get col. values for all selected rows

From a single column, Selectiontype=MultiExtended GridListControl, I am trying to get the values in the column. Below is the code I''m using in the SelectedValueChagnged event. The problem occurs at the line that attempts to extract the text using GetItemText for the Item in the GridStyleInfoStore - in the debugger it exists the line and produces no exception - the procedure does not complete. Dim grd As GridListControl = DirectCast(sender, GridListControl) Dim ranges As GridRangeInfoList = grd.Grid.Rows.GetSelectedRowColRanges Dim range As GridRangeInfo Dim store As GridStyleInfoStoreTable Dim col As Integer = 0 Dim txt As String For Each range In ranges store = grd.Grid.Rows.GetCells(range.Top, range.Bottom) For row As Integer = 1 To store.RowCount If Me.txtLocationSelections.Text = "" Then txt = grd.GetItemText(store.Item(row, col)) Else txt = Me.txtLocationSelections.Text & ", " & grd.GetItemText(store.Item(row, col)) End If Next Next Me.txtLocationSelections.Text = txt Me.txtLocationSelections.Refresh() Thank you to the SyncFusion team, Kenton

2 Replies

AD Administrator Syncfusion Team November 20, 2004 06:40 PM UTC

Below is some code that work for me in a buttonhandler. As far as your colde goes, column 0 in a GridControl is the row header column (which is hidden in the embedded grid in a GridListCOntrol). So, you should try using column 1 instead of column 0. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles Button1.Click Dim txt As String = "" Dim rangeList As GridRangeInfoList = Me.ListBox1.Grid.Selections.GetSelectedRows(True, False) Dim range As GridRangeInfo Dim row As Integer For Each range In rangeList For row = range.Top To range.Bottom If txt.Length > 0 Then txt = txt & "," End If txt = txt & Me.ListBox1.Grid(row, 1).Text Next Next Console.WriteLine(txt) End Sub


KH Kenton Hensley November 21, 2004 02:16 AM UTC

Thank you Clay, I missed the Selections collection. My excuse? -too little sleep.

Loader.
Live Chat Icon For mobile
Up arrow icon