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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Get Selected Row Information returned from GridListControl

Thread ID:





28140 Apr 25,2005 06:37 PM UTC Apr 27,2005 03:01 AM UTC WinForms 5
Tags: GridControl
Bob Wis
Asked On April 25, 2005 06:37 PM UTC

We just started working with Essential Studio and our developer ran into an issue using the GridListControl. We present a list to the user for them to select a row and hit the Select button. The following code was implemented to read the value of the row the user selected. But instead of the selected row''s value we get "System.Data.DataRowView" returned. How do you get the value(s) from the selected row returned to the program? Here is our current code: Private Sub btnSelect_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSelect.Click Dim grd As DataGrid Dim selind As Integer Dim obj As Object obj = Me.GridListControl1.SelectedItem() selind = Me.GridListControl1.SelectedIndex curprj = Me.GridListControl1.GetItemText(Me.GridListControl1.SelectedItem) Me.Close() End Sub

Administrator [Syncfusion]
Replied On April 26, 2005 12:01 AM UTC

Hi Bob, Here is some code to get the selected values in GridListControl. private void button1_Click(object sender, System.EventArgs e) { GridRangeInfoList list; this.gridListControl1.Grid.Selections.GetSelectedRanges(out list, true); foreach(GridRangeInfo range in list) { GridRangeInfo range1 = range.ExpandRange(1,1,this.gridListControl1.Grid.RowCount, this.gridListControl1.Grid.ColCount); for(int i = range1.Top; i <= range1.Bottom; i++) for(int j= range1.Left; j <= range1.Right; j++) { Console.WriteLine(this.gridListControl1.Grid.Model[i, j].Text.ToString()); } } } Best Regards, Jay N

Bob Wis
Replied On April 26, 2005 12:30 PM UTC

Thanks Jay, Thanks for the info. One question: It appears that your example is in C# and We are using VB.NET. We were wondering how you would accomplish the same thing in VB.NET? Bob

Administrator [Syncfusion]
Replied On April 26, 2005 06:19 PM UTC

Hi Bob, Here is the VB.NET code: Dim list As GridRangeInfoList Me.gridListControl1.Grid.Selections.GetSelectedRanges(list, True) Dim range As GridRangeInfo For Each range In list Dim range1 As GridRangeInfo = range.ExpandRange(1, 1, Me.gridListControl1.Grid.RowCount, Me.gridListControl1.Grid.ColCount) Dim i As Integer For i = range1.Top To range1.Bottom Dim j As Integer For j = range1.Left To range1.Right Console.WriteLine(Me.gridListControl1.Grid.Model(i, j).Text.ToString()) Next j Next i Next range Best regards, Jay N

Bob Wis
Replied On April 26, 2005 11:03 PM UTC

Jay, Thanks again. The code generates a build error that the GridRangeInfo and GridRangeInfoList types are not defined. Are we missing a Reference to one of the libraries? Bob

Administrator [Syncfusion]
Replied On April 27, 2005 03:01 AM UTC

Hi Bob, Please include this namespace: Imports Syncfusion.Windows.Forms.Grid Best regards, Jay N


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon