+ 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
    O365
    Posts
    20,431

    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
    O365
    Posts
    20,431

    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
    O365
    Posts
    20,431

    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)

Similar Threads

  1. [SOLVED] Userform runs Initialize sub @ beginning of textbox AfterUpdate event w/out being called
    By chirp08 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-18-2016, 01:02 PM
  2. AfterUpdate Event triggered without updating the textbox
    By mschatteles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2015, 02:24 PM
  3. creating a custom class event for worksheet textbox lostfocus
    By Willardio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2013, 02:00 AM
  4. AfterUpdate event in a Class Module
    By Mats Samson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2012, 06:24 PM
  5. AfterUpdate event for dynamic TextBox
    By moyo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2007, 02:23 AM
  6. Replies: 0
    Last Post: 11-30-2005, 01:10 PM
  7. [SOLVED] Handling of event raised in other class module
    By VbaNew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2005, 09:06 AM

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