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.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Satish KathiRank #8,369 · 223 reputationPosted Jul 24, 2008, 12:03 PM EDT
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();
}
jed ong9 reputationPosted Jul 24, 2008, 7:11 PM EDT