I\'m trying to select the first row where the cell value starts with the same keychar the user pressed. That\'s the part that is giving me trouble.
Here\'s how I\'m hand
if (Char.IsLetterOrDigit(e.KeyChar))
{
foreach (DataGridViewRow dgvRow in myDgv.Rows)
{
if (dgvRow.Cells["ColumnName"].FormattedValue
.ToString().StartsWith(e.KeyChar.ToString(), true, CultureInfo.InvariantCulture))
{
dgvRow.Selected = true;
break;
}
}
}
If the DGV is set up to allow Multi-Select then you'd obviously want to deselect any existing selection.