I'm a bit confused, as far as I remember the Textbox used to launch the Validating event when the used pushed the Enter key after entering the desired text but this is not happening now.
Do you know if this is the expected behavior or not?
Thanks.
see:Control.Validating Event
Note: If the CausesValidation property is set to false, the Validating and Validated events are suppressed.
I use a method similar to Javed Akram's answer, but instead of calling the Validating function, I just call focus on the parent...
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
(sender as TextBox).Parent.Focus();
}
}
When the TextBox itself looses focus it will call its own Validating event
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With