I prefer not to use the Exit or LostFocus event for stuff like this. They
work fine when the user leaves your control via the Tab or Enter key, but
if they leave that control by clicking somewhere with the mouse (or go
backwards by using Shift-Tab), then this code will override the user's
desired action and force them to go where you "thought" they were going.
This would be very irritating I should think.
The method I use is to add a small-but-visible TextBox to the TabPage and
make it last in the TabOrder. In its GotFocus event I run code to set
focus to the next TabPage. The only way this control ever gets focus and
thus the only time my code runs is if they leave the last "useful" control
on the page via the Tab or Enter key. It does not interfere with other
movements the user might make.
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com