0

I'm using visual studio 2008 .net 3.5 (windows application) I have a Devexpress datagridview and I want to select multiple rows using checkboxes . I have found this Code in Devexpress Forum.( http://www.devexpress.com/Support/Center/p/E1271.aspx ) it works very good , but I dont know how to recognize which rows are selected !

I want user select some rows with checkboxes and then copy the selected rows to another datagrid. thank you

2 Answers 2

1

You might be looking for:

yourDataGridView.SelectedRows

which returns a DataGridViewSelectedRow collection. You can iterate it through a foreach loop, like:

foreach (selectedDataGridViewRow row in yourDataGridView.SelectedRows)
{
    // do what you got to do with the selected row...
}
Sign up to request clarification or add additional context in comments.

1 Comment

Please expand your question to show what you have attempted and where/why you are stuck
0

As I understand the code sample from DevExpress there's the member selection that stores the selected rows. The following two parts of the sample seem to approve that:

protected ArrayList selection;

//...

void SelectRow(int rowHandle, bool select, bool invalidate) {
    if (IsRowSelected(rowHandle) == select) return;
    object row = _view.GetRow(rowHandle);
    if (select)
        selection.Add(row);
    else
        selection.Remove(row);
    if (invalidate) {
       Invalidate();
    }
}

Have a look at this member, I think that's what you are searching.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.