How to simulate JavaScript onBlur in Windows Forms?

I have windows and phone text boxes in a Windows form that I want to check when a user leaves the fields.

When I double-click on a text field in the Visual Studio Form Designer, it textchanged event. This is not entirely suitable, because you want to call the verification method only after the user has entered the full record, and not after each keystroke.

Is there a way to make this look like an onBlur event in JavaScript?

I tried MouseLeave , Off Focus , and they all act as textchanged .

How can I do that?

+7
events winforms
source share
4 answers

Try the Leave event. Go to the properties page for your control.

You can simply enter the name of the method that you will create. Press Enter and Visual Studio will create this method for you.

enter image description here

enter image description here

+7
source share

The Validating event is for this. Set e.Cancel = true if you are not comfortable with the input. The ErrorProvider component is ideal for visual feedback.

+6
source share

OnLostFocus , maybe?

-one
source share

There is an OnLostFocus event for the controls here. You must use this.

-one
source share

All Articles