[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2618
  • Last Modified:

Change Versus AfterUpdate

I have a very simple question...When i double click on a textbox or combobox while in design mode in VBE it adds a sub procedure like Sub Textbox1_Change()....It never adds Sub Textbox1_afterupdate....I have used both and can't tell the difference....What is the difference between these two and is one better than the other?
0
ToddHawley4984
Asked:
ToddHawley4984
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>What is the difference between these two and is one better than the other?
In my experience the only time Change is used is with tab controls, when a user clicks on a tab it fires the tab control Change event.  Otherwise, use AfterUpdate.
0
 
Patrick MatthewsCommented:
Neither is intrinsically better than the other--it's a matter of what you need to, and picking the
right event to handle it.

For textboxes...
The Change event fires as soon as you start typing in the textbox.  AfterUpdate does not
fire until after you tab off of the control, basically.  So, if I want to enter "foo" into a text box,
the Change event would fire three times, and AfterUpdate just once.  There is also a
BeforeUpdate event that I find extremely useful if I need to validate entries.
0
 
Patrick MatthewsCommented:
Jim,

I'll use the Change event with list-only comboboxes.  I stay away from the Change event in
textboxes for the reason stated above :)

Regards,

Patrick
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
{a qualification on my earlier comment }
Most of that is from Access VBA experience.  Excel VBA or VB may differ, and if so matthewspatrick would know it.
0
 
antontolentinoCommented:
change event is useful if you want to simulate the auto complete suggestion list
0
 
ToddHawley4984Author Commented:
Great thats what i was missing Thank you
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now