Hi
I have a grid which I need to select multiple rows and process the contents of each rows cells
I have tried looping through the rows in the grid and checking the grid.Rows(i).Activated = true
but this only returns the first Active row in the grid.
Is there another property which distinguishes selected rows from non selected rows ??
Is there a difference between active and selected rows
Thanks
Colm
Each row has a property named "Selected".
Active row is the row that has the input focus, hence there is only one active row. Selected row is a row that was selected by the user or by code and there could be more than one.
If you want to get all selected rows use grid.Selected.Rows
If you want to select all rows, don't go over them and set Selected = true because this can be very slow, but use grid.Selected.Rows.AddRange(grid.Rows)
Thanks for the help
I just implemented the suggestion for selected rows but when I select several rows the grid.Selected.Rows returns zero rows
Is there some other property that needs to be set on the grids to allow multiple row selection
If you are seeing selected rows in the grid and grid.Selected.Rows returns no rows, then something is wrong and the rows are not really selected. Are you sure you are looking at the right grid control? Are you sure the rows are actually selected? How are you selecting them?
I am using an Infragistics.Win.UltraWinGrid.UltraGrid
To select the rows I am simply clicking on a row and then using the shift key and the direction arrows to highlight the rows below that row,
I am looking at the correct grid and using the following code
Dim row As Infragistics.Win.UltraWinGrid.UltraGridRow
sSQL = "Delete from OverallSageLink where Bankref = '" & grdSage.ActiveRow.Cells(1).Value................
The statement grdSage.Selected.Rows is at zero no matter what I select
Hi,
I don't see how that could possibly happen. If it is happening, then it sounds like a very serious bug. But I have not heard any other reports of this.
Can you duplicate this in a small sample project?
I'm seeing this same issue in an ultragrid.
I figured out that my problem had to do with setting the RowSelectors property to false like so: grdCurrent.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
Holding the shift key down and clicking the mouse selected multiple cells but it does not select multiple rows. When I set the above property to Infragistics.Win.DefaultableBoolean.True, the row selector column is displayed and holding down the shift key and clicking the mmouse in the row selectors column will select multiple rows. In summary, setting the RowSelectors property to true and using the row selector column to select multiple rows solved my problem.