Home Ask Login Register

Developers Planet

Your answer is one click away!

SamSam7 February 2016

VB6 + VB.NET lostFocus vs Validate?

I'm sure this question can apply to both, although I'm usually working with VB6 code, but why use Lost Focus vs Validate? As an example, say I need a date entered in a text box for date of birth, i want to make sure that date is entered in mm/dd/yyyy format, why would I choose to go with Validate vs Lost Focus?


Matt Wilko February 2016

Lost focus only fires when the user moves focus from that control to another one. The validated event fires at the point of validation. More info on validation here: WinForm UI Validation

Note that you should use a datetimepicker for date entry; that way you do not have to worry amount the format entered as it's value property is a date

Post Status

Asked in February 2016
Viewed 1,222 times
Voted 13
Answered 1 times


Leave an answer

Quote of the day: live life