I have a C# lookup window that I wanted to add hitting the Enter/Return key to return the value. As soon as I did that it killed double click. As soon as I move the mouse pointer the lookup window exits. How do I get this to work so both double-click and Enter return the value?
private void dgvBatches_DoubleClick(object sender, EventArgs e)
{
int currentRow;
currentRow = dgvBatches.CurrentCell.RowIndex;
dgvBatches.CurrentCell = dgvBatches[0, currentRow];
CellValue = dgvBatches.CurrentCell.Value.ToString();
DialogResult = DialogResult.OK;
return;
}
private void dgvBatches_Enter(object sender, EventArgs e)
{
int currentRow;
currentRow = dgvBatches.CurrentCell.RowIndex;
dgvBatches.CurrentCell = dgvBatches[0, currentRow];
CellValue = dgvBatches.CurrentCell.Value.ToString();
DialogResult = DialogResult.OK;
return;
}
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.