Getting the select row from a databound grid

bsimbeck

Newcomer
Joined
May 2, 2003
Messages
1
Is there anyone out there who knows how to get the selected row from a data grid? I am diplaying multiple fields from a database and I want to get the currently selected rows to open an edit form and for deletions.

Thanks,

Branden
 
Here are two methods...

Visual Basic:
'ds being a DataSet
Dim SelRow As Integer
For SelRow = ds.Tables(0).Rows.Count() - 1 To 0 Step -1  
'For SelRow = DataGrid1.VisibleRowCount - 1 To 0 Step -1 'Same as previous line
    If DataGrid1.IsSelected(SelRow) = True Then
        'Do something here with each selected row
    End If
Next
 
Back
Top