Datagrid Column Help
Is is possible to assign a hotkey to the datagrid? for example i have a datagrid that's composed of 3 columns age,name and id number. if i click a certain record.and press a certain hotkey for example f1.. what it does is that it reads the record's id number and stores it in a string.. is it possible? thanks in advance.
jed ongPosted Jul 24, 2008, 11:11 PM
Satish KathiPosted Jul 24, 2008, 4:03 PM
Here is the code to get Id when you press F1, assuming your datagrid contains Id at First Column
private void dataGridView1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F1)
textBox2.Text = dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString();
}