I have a toolstrip dropdownbutton which contains textbox in the dropdown menu. I'm trying to make it fire Validate event properly when an Enter key is pressed.
I have this simple code:
private void txtSourceUrl_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{
txtSourceUrl_Validated(null, null);
}
}
Which works, But, it still makes the Windows sound for "improper input" (that "ding!") play, which is unfortunate. I don't know how to get rid of it, or how to do it properly, as this method I'm using seems to be kind of a hack.
I searched the text box properties, but there seems to be nothing related in there (AcceptsReturn doesn't work as text boxes in the dropdown can't be multiline). Any ideas?