Not able to detect arrows key. I understand that it's the default behavior of datagridview cell for moving focus to next/previous/up/down. I googled a lot about this topic but didn't find the exact solution.
Here is my code.
private void dgvHP_OPDPrescriptionDiagnosis_Detail____EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
switch (dgvHP_OPDPrescriptionDiagnosis_Detail___.CurrentCell.ColumnIndex)
{
case 9:
TextBox txtDiagnosis = e.Control as TextBox;
if (txtDiagnosis != null)
txtDiagnosis.KeyDown += new KeyEventHandler(DiagnosisKeyDown);
break;
}
}
private void DiagnosisKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Down)
{
MessageBox.Show("Hi");
}
}