Hi,
If you want to get all the selected row index, you can use the following code:
void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
foreach(DataGridViewRow r in dataGridView1.SelectedRows)
{
Console.WriteLine(r.Index.ToString()); //get the row index
}
Console.WriteLine();
}
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.