M
Mark B
OL2007, VSTO C#
I have a number spinner in a form region. If the user tries to delete some
text in it with the delete key on the keyboard, Outlook instead has been
deleting the email.
If have tried to intercept the following events to no avail:
bool nonNumberEntered = false;
private void numericUpDownCustomNumber_KeyDown(object sender, KeyEventArgs
e)
{
nonNumberEntered = false;
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
nonNumberEntered = true;
}
}
private void numericUpDownCustomNumber_KeyPress(object sender,
KeyPressEventArgs e)
{
if (nonNumberEntered == true)
{
// Stop the character from being entered into the control
since it is a delete keypress.
e.Handled = true;
}
}
If anyone knows a way I'd appreciate it. Worst case I thought I could
temporarily enable a delete confirmation popup but can't see that Outlook
has that option.
I have a number spinner in a form region. If the user tries to delete some
text in it with the delete key on the keyboard, Outlook instead has been
deleting the email.
If have tried to intercept the following events to no avail:
bool nonNumberEntered = false;
private void numericUpDownCustomNumber_KeyDown(object sender, KeyEventArgs
e)
{
nonNumberEntered = false;
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
nonNumberEntered = true;
}
}
private void numericUpDownCustomNumber_KeyPress(object sender,
KeyPressEventArgs e)
{
if (nonNumberEntered == true)
{
// Stop the character from being entered into the control
since it is a delete keypress.
e.Handled = true;
}
}
If anyone knows a way I'd appreciate it. Worst case I thought I could
temporarily enable a delete confirmation popup but can't see that Outlook
has that option.