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.

GridListControl: Get col. values for all selected rows

Thread ID:

Created:

Updated:

Platform:

Replies:

21780 Nov 20,2004 12:49 PM Nov 20,2004 09:16 PM Windows Forms 2
loading
Tags: GridControl
Kenton Hensley
Asked On November 20, 2004 12:49 PM

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

Administrator [Syncfusion]
Replied On November 20, 2004 01:40 PM

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

Kenton Hensley
Replied On November 20, 2004 09:16 PM

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

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.

;