Maybe I should rephrase the title.
The complexity of controls' Events For Newbies.
I see a bunch of similar events for controls and I can not understand how they differ from each other.
I know (read somewhere) there's a certain order for these events to happen, but how the effect of these events on the result is different remains a mystery.
Some of them are reasonable. I can understand how Before_Update differs from After_Update and how they can be used in different situation, but isn't Enter the same as GotFocus? I can't imagine a scenario when the code should go to Enter but not to GotFocus and visa verse.
Exit and LostFocus are two more.
Is there any specific situation a code should be written for Exit that can not be used in LostFocus?
Is there a situation when you needed to run a code after a user press a key and before the textbox changes? (On_KeyDown event vs On_Change)?
KeyDown and KeyPress are two more confusing events?
Let's take a checkbox as an example with its 4 events : Click/GotFocus/Enter/beforeupdate.
If you click a checkbox, the focus moves to the checkbox, mouse enters the control and it changes.
How many times you needed to put a code in on_Click of a checkbox and using the other GotFocus or BeforeUpdate couldn't satisfy your purpose?
Note: I know someone can use the tab key to move between controls. In this case only GotFocus event is fired. But do you really need to run a code even when the focus is moved to a control with tab key?
Any insight is much appreciated.
The complexity of controls' Events For Newbies.
I see a bunch of similar events for controls and I can not understand how they differ from each other.
I know (read somewhere) there's a certain order for these events to happen, but how the effect of these events on the result is different remains a mystery.
Some of them are reasonable. I can understand how Before_Update differs from After_Update and how they can be used in different situation, but isn't Enter the same as GotFocus? I can't imagine a scenario when the code should go to Enter but not to GotFocus and visa verse.
Exit and LostFocus are two more.
Is there any specific situation a code should be written for Exit that can not be used in LostFocus?
Is there a situation when you needed to run a code after a user press a key and before the textbox changes? (On_KeyDown event vs On_Change)?
KeyDown and KeyPress are two more confusing events?
Let's take a checkbox as an example with its 4 events : Click/GotFocus/Enter/beforeupdate.
If you click a checkbox, the focus moves to the checkbox, mouse enters the control and it changes.
How many times you needed to put a code in on_Click of a checkbox and using the other GotFocus or BeforeUpdate couldn't satisfy your purpose?
Note: I know someone can use the tab key to move between controls. In this case only GotFocus event is fired. But do you really need to run a code even when the focus is moved to a control with tab key?
Any insight is much appreciated.
Last edited: