Results 1 to 5 of 5

Thread: Text Changed

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Text Changed

    Is there a way to have 1 procedure handle all the textchanged events on a certain form?

    I have a boolean variable I am using to check whether the user has editted any information, and I need to set it to true if any of the textboxes get changed.

    So is there any like global "text changed" event or anything?

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Text Changed

    form has an event called Dirty (I think) that should tell you if the user has changed anything.

    Alternatively, there is a tag property on the controls, whichc doesn't seems to do much, and you can shove the initial values into that as well as the control, then later, check the tags against the controls values to see if anything has changed.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Text Changed

    hrm, well dirty doesnt work....And using the tag property seems like it would be more coding than adding 6 textboxes textchanged events.

    Thanks anyways

  4. #4
    Fanatic Member
    Join Date
    Sep 2002
    Location
    Lexington, SC
    Posts
    586

    Re: Text Changed

    This isn't exactly a global text changed event but it can be made to work as one. If you turn the forms KeyPreview value over to true then use the form_keypress form_keydown form_keyup subs you can tell when the person presses a key.

    It would be up to you from there to determine if it was a change that you want to handle or not. To delve into that a little further lets say you were watching for changes in any textbox on your form you could do,

    VB Code:
    1. Sub Form_KeyUp(KeyCode As VbKeyCode) ' I know the sub isn't correct
    2. If ActiveControl.Type = TextBox Then
    3.     'Handle the change
    4. End If
    5. End Sub

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Text Changed

    Or you could in each of the events for the textboxes make another call to a central procedure to perform the common tsks.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width