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?
I would add another field
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
dont know if thats what you want but might work.
CORRECTIONS TO THE ABOVE:
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
For x = 0 To grdRows
If .IsSelected(x) Then
' Do something