Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Got_Focus, Lost_Focus Event
Hey There -
I'm having a problem with code firing at unexpected times.
I have a form that is populated. There is a button that will restart the form - basically clear out all of the information. If I just let the code run either full compiled or not I get an error message because of code setting focus to an object. The code is running a procedure calling setfocus that it does NOT call if I step through the code.
1) How is this possible? I can take the same exact steps and if I let the code just run I get an error, but if I step through the code I do not get the error.
2) In the extra code that is being run: There are two textboxes next to each other text1, text2. text1 loses focus, text2 gets and loses focus: the code is
Private Sub Text1_Lost_Focus()
text1.backcolor = FOCUS_BACKCOLOR
End Sub
Private Sub Text2_Got_Focus()
text2.backcolor = NO_BACKCOLOR
End Sub
Private Sub Text2_Lost_Focus()
text2.backcolor = FOCUS_BACKCOLOR
End Sub
What is causing the code to run the got_focus, lost_focus of text2? I am not resetting focus to another object.
3) Does anybody know where I can find a white paper that says the order events are fired (and the cause) for objects other then Form?
I'm not sure if I explained my problem very well. Let me know if I can explain something better!
Thanks,
Nichole
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement