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());
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top