Textbox validating event
There is, however, a small trap here which can catch the unaware developer out.
The best way to show you this is with a small example.
Take for example the Wizard which we designed earlier.
We placed in some simple validation that checked whether a required entry was made and did not allow the user to move forward to the next step until such time.
The object that "has the focus" is normally indicated by a highlighted caption or title bar.
The only danger in doing this is the possibility that the entry that gets added to the list is not valid for the list it is being added to.However, as I also said in the last lesson, in many cases it is virtually impossible to account for all possible erroneous data.Possibly a close exception to this rule would be when we use a List Box or Combo Box and allow the user to choose their entry from the control.Now that we have put a definition to the word Focus, we can look at how the Exit event can be used to run a validation check.
The least you need to know to use the Exit event efficiently is that the Exit event will fire immediately before a control looses Focus to another control on the same form.
For cases like these, the decision is relatively simple.