Wednesday, September 29, 2010

CODE FOR SELECTING WHOLE ROW IN DATAGRIDVIEW !!!!!

Hello Again
Suppose we want to select whole row in the DataGridView with a single enter click.
Then for this purpose we have the following code ------->>>>>


//Write this code in keydown event of DGV!
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
if (e.KeyCode == Keys.Enter)
            {

               this.dataGridView1.CurrentRow.Selected = true;
                e.Handled = true;
            }
        }



Hope it will work.
Any kind of comment are welcome

No comments:

Post a Comment