SelectedRowCount is incorrect

Hi,


The following code used to work in DBAdvGrid V2.3.2.0

   for (int i = 0; i < DBGrid->SelectedRowCount; i++)
   {
     int row = DBGrid->SelectedRow;
int id = DBGrid->Ints[0][row];
...
     }

I've just upgraded to DBAdvGrid V2.3.6.21 and this code now crashes because SelectedRowCount returns 2 when no rows are selected (presumably it is counting the header and footer rows as selected rows).
     int row = DBGrid->SelectedRow returns -1 which then causes an array index exception on the following line.

If can work around this by checking that row is >= 0 but I have a lot of instances of this code throughout my app that I need to update.

Can you please confirm if this is a bug been introduced?

Regards
Adam


We are not aware of such issue. Is this with What is you setting for Grid.PageMode?

I've tried it with PageMode = true and false and still the same.

I think it happens when the data set has not been opened yet. It appears to be counting the FloatingFooter as a selected row. SelectedRowCount = 2, the first selected row returns 1. The second selected row returns -1.  Once the data set is opened SelectedRowCount returns to the correct value of 1.

Regards
Adam

For disjunct row selection, please set grid.PageMode = false or implement the technique as demonstrated in the sample ADOSelection in the DBAdvGrid samples folder.