+ Reply to Thread
Results 1 to 6 of 6

AfterUpdate Event Handling for a textbox class

  1. #1
    Registered User
    Join Date
    05-03-2018
    Location
    DFW
    MS-Off Ver
    365
    Posts
    3

    AfterUpdate Event Handling for a textbox class

    I have a class that groups several textboxes in a userform for event handling. Here is the class:
    Please Login or Register  to view this content.
    And here is the code inside the userform
    Please Login or Register  to view this content.
    I have a custom EnableEvents boolean so I can manually enable and disable the event firing when i need to (since Application.EnableEvents doesnt work in this situation).

    The above code works great, except the change event happens every single time I type a character. In the past, I've used the AfterUpdate event on each individual textbox control, but it will not work on this class. Any ideas on how i can catch the event when the whole field is updated (afterupdate, exit, etc)?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003, 2007, 2010 & 2013
    Posts
    18,924

    Re: AfterUpdate Event Handling for a textbox class

    Unfortunately those events are not exposed when you create a event class for userform controls.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003, 2007, 2010 & 2013
    Posts
    18,924

    Re: AfterUpdate Event Handling for a textbox class

    Not sure if this will help but you can fashion something to determine enter/exit of textboxes but it requires the Change event to recognise the movement.

    show the userform and then type in textbox and move betwen controls. The exit/enter will be logged in the listbox. You could extend this to update activectl in objects by
    using the events of single occurance controls on the userform
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-03-2018
    Location
    DFW
    MS-Off Ver
    365
    Posts
    3

    Re: AfterUpdate Event Handling for a textbox class

    Is there any way to catch the exit event without having to begin editing the next box? Currently, it is very possible that users only edit one of the 15-20 textboxes.

    I'm glad you posted this code, because I was thinking of how to flag the event with the textbox name.

  5. #5
    Registered User
    Join Date
    05-03-2018
    Location
    DFW
    MS-Off Ver
    365
    Posts
    3

    Re: AfterUpdate Event Handling for a textbox class

    Quote Originally Posted by Andy Pope View Post
    it requires the Change event to recognize the movement.
    What events are handled with classes, other than change?

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003, 2007, 2010 & 2013
    Posts
    18,924

    Re: AfterUpdate Event Handling for a textbox class

    In order to catch an exit, when the control being entered is not one of the other textboxs, would require adding more code to all the other controls in order to keep track of active and previously active control

    You can use Object Browser (F2) in VBE to see the event available to MSForms.Textbox control

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1