I have a DataGrid. I'd like the user to be able to select multiple rows in the Grid, then click a Button to indicate they are finished. I'll then do some calculations based on the rows they selected. I know the rows can be selected by holding down CTRL while clicking the mouse. How can I tell which rows have been selected in my code
Thanks,
BB

VB.NET multiple selections in DataGrid
TFink
and make it type boolean
that way you could select which fields you want to edit using a check box.
then hit a button and then cycle thro the datatable for the selected fields/
'I make big type-os.. :)
dim x as intergar
for x = 0 to dataset1.datatable1.rows.count - 1
if dataset1.datatable1.rows(x).item("booleanfield") = true then
' do your calcualtation code here based on that row
end if
next
dont know if thats what you want but might work.
R_S_Chandrashekar
VisibleRowCount won't get the job done, as that Property is only the number of rows that are visible. You need to coordinate your dataset with your grid, like this:
Dim grdRows as integer
grdRows = DataSet.Tables(0).Rows.Count - 1
With grd
For x = 0 To grdRows
If .IsSelected(x) Then
' Do something
End If
Next
MS_Developer
For x = 0 To .VisibleRowCount - 1
If .IsSelected(x) Then
MsgBox("Found selected row - " & x)
MsgBox("Data in column 0 = " & .Item(x,0))
End If
Next
Drashti
For x = 1 to grd.VisibleRowCount
If grd.isSelected(x) Then
' code to take whatever action you want
End If
Next
Francisco Graziano