How to mimic JavaScript's onBlur event in Windows Forms?

.net, events, winforms

Solution

Try the `Leave` event. Navigate to the Property page for your control.

You can simply type the name of the method you'll be creating. Press Enter and Visual Studio will create the method for you.

Problem

I have phone and email textboxes on a Windows Form that I want to validate when the user leaves the fields. When I double click the textbox in Visual Studio form designer, it creates a `textchanged` event. This isn't quite suitable as want to call the validate method only when the user is done entering the full entry, not after every keystroke. Is there a way to do this similar to `onBlur` event in JavaScript? I have tried `MouseLeave`, `Off Focus`, and they all act like `TextChanged`. How can this be done?

Original source