I have a DataGridView control named uxContactEmailAddressesGrd. It is data bound to a collection of email address objects. It has 3 columns:
This seems to work fine with one slight problem: The 1st char I type in the cell is always swallowed up, i.e. I have to press the 1st char of a word twice for it to be shown in the cell.
What have I done wrong to cause this? I thought I had it licked by continuing to call the base class with the entered char, but seemingly not. Can anyone help with this problem? How do I stop it from swallowing the 1st char type?
- Hidden: email Primary Key (PK) (int)
- shown: email address (string)
- Shown: email type (combobox, ValueMember=int, DisplayMember=String)
public sealed class XDataGridView : DataGridView
{
private bool _singleUpdateOnly = true;
public bool SingleUpdateOnly
{
get { return _singleUpdateOnly; }
set { _singleUpdateOnly = value; }
}
[Description("Disallows user adding rows as soon as a key is struck to ensure no blank row at bottom of grid")]
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
if (SingleUpdateOnly)
{
//AllowUserToAddRows = false;
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
What have I done wrong to cause this? I thought I had it licked by continuing to call the base class with the entered char, but seemingly not. Can anyone help with this problem? How do I stop it from swallowing the 1st char type?