Sunday, 7 October 2012

C# DataGridView RowIndex

How To Find dataGridView Selected Row index ?

This tutorial i am using dataGridView Key Down event to first Select the row and then press Enter key then
msg box show the selected Row index

 private void datagridview1_KeyDown(object sender,KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                   MessageBox.Show(dataGridView1.SelectedRows[0].Index.ToString())

            }
        }

the image is below..

No comments:

Post a Comment