difference between lostfocus and on exit

M

mcnewsxp

what practical difference is there in using lostfocus or on exit besides the
cancal param?
 
B

Brendan Reynolds

Another significant difference between the two events is that the Exit event
is not fired when you move to another form, the LostFocus event is.

For example, if you have two forms, Form1 and Form2. Form1 has two text
boxes, the first text box has these event procedures ...

Private Sub Text0_Exit(Cancel As Integer)

MsgBox "Exit"

End Sub

Private Sub Text0_LostFocus()

MsgBox "lost focus"

End Sub

When you exit the first text box on Form1 by clicking in the second text
box, you'll see both messages displayed. When you exit the first text box on
Form1 by clicking on Form2, only the second, 'lost focus' message is
displayed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top