i am trying to get selected row index but i got error
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
MessageBox.Show(dataGridView1.SelectedRows[0].Index.ToString());
}
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
whats wrong