DataGrid and MultiSelect

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

Apparently the DataGrid only supports single select in CF 1.0. Although you
can highlight multiple rows, only one has the triangle and is returned as
the row selected.

Is there any way to fake it? I'd like to get a list of primary keys for rows
that are highlighted and perform some operations.

I figure this is something that someone has done before, so any examples are
helpful.

Nathan
 
You may try the following code:

int top = dataGrid1.CurrentRowIndex;
while(top - 1 > -1 && dataGrid1.IsSelected(top - 1)) top--;

int bottom = dataGrid1.CurrentRowIndex;
int numberOfRecords = 100;
while(bottom + 1 < numberOfRecords && dataGrid1.IsSelected(bottom + 1))
bottom++;

MessageBox.Show("Indices range of selected rows: " + top.ToString() + "
- " + bottom.ToString());
 
Back
Top