LostFocus and the Toolbar
Posted on 1998-08-03
I have an MDI app with a toolbar. The code in ButtonClick for the Save button simply calls the save functionality on the active child form. I also have placed textbox field-level validation throughout the app in the lostfocus subroutines.
The problem: If I enter data into a given textbox BUT DO NOT TAB OFF then press the save button on the toolbar, the save functionality gets fired without the field-level validation getting fired. The result is that invalid data can get saved to the database.
Question: How can I get the field-level validation to fire in the described scenario? It is not acceptable to do field-level validation at save time.
Using setfocus to change the focus to another control does not fire the lostfocus on the original control (already tried to do this).
Basically, since the Toolbar is on the MDI form, clicking a button on it does not make the control on the Child form lose focus. How do I get around this?