Groups | Blog | Home
all groups > vb.net controls > june 2005 >

vb.net controls : How can I get the row count from a DataGrid control?


Ken Sturgeon
6/2/2005 9:38:15 AM
Within a function I have populated a datagrid with the contents of a
dataset...

Private Sub ()
Dim ds As New DataSet
Dim dg as DataGrid = frmMain.dg
...
dg.DataSource = ds
...
End Sub

I now need to itterate through the grid to determine which row(s) the user
has selected. How can I accomplish this? I have searched and searched but
I've not been able to find any examples.

Thanks in advance for your help.

Ken Sturgeon

nate axtell
6/2/2005 12:32:45 PM
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q775q
5.21 talks about using DataGrid.IsSelected in a loop for that.

[quoted text, click to view]

Ken Sturgeon
6/2/2005 2:18:50 PM
Thank you for the pointer to the syncfusion FAQ, it looks like it's loaded
with good info. I see in the example that he's using a CurrencyManager, I'm
not sure what that is, nor am I sure that I'd even need that... I do believe
that the key is that I need a BindingContext... I have much to learn.

I do appreciate your time in pointing me to this and thank you again for
your help.

[quoted text, click to view]

AddThis Social Bookmark Button