Results 1 to 5 of 5

Thread: Checking For Changed Text

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Somewhere else today
    Posts
    355

    Checking For Changed Text

    I have 22 text boxes that have to be checked to see if the value has changed. I am using the TextChanged Event handler to do this thus:

    Code:
    Private Sub TextStringChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) 
    
    
            DataChanged = True
            RemoveHandler ........
            RemoveHandler ........
    
            Etc ......
    
    End Sub
    The Handler would be added after the data had been loaded. The question is:

    Is there another way of checking for text changes without having to add and remove 22 handlers.

    Computerman
    It was much easier in VB6, but I am now liking Vb.Net alot more.

  2. #2
    Junior Member
    Join Date
    Sep 2010
    Posts
    16

    Re: Checking For Changed Text

    I'm pretty sure you could, after the text changes, make a string variable and also check it at an occasion, like "If source == ChangedText then..." or something like that.

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Checking For Changed Text

    In one textchange handler you can do handles textbox1.textchange,textbox2.textchange,textbox3.textchange
    ...etc
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Checking For Changed Text

    Quote Originally Posted by sapator View Post
    In one textchange handler you can do handles textbox1.textchange,textbox2.textchange,textbox3.textchange
    ...etc
    Further to this, you can have the IDE add them all to the Handles clause for you using the designer. Open the form in the designer and then select all the desired controls. Open the Properties window and click the Events button at the top. Double-click the desired event and, hey presto, the IDE generates a single event handler with all the selected controls in the Handles clause. After the fact, you can select another control and then select the exiting event handler from the drop-down for the desired event. This is how event handlers have been created in C# from the original VS.NET, but it was only added to VB in 2005.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Checking For Changed Text

    Yes but doing it from the designer is lame ("TRUE" metal sign here).
    Ok i'm joking, thanks for the info, i guess some things still haunt me from my vs2003 days
    Come to think of it, the PC i'm now still has vs2003 and i still use it occasionally
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

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