Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to identify the changes in TextBox?

How to identify the changes in TextBox?

Scheduled Pinned Locked Moved C#
questiontutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nothend
    wrote on last edited by
    #1

    Hi all: I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change? Nothend

    C Q 2 Replies Last reply
    0
    • N Nothend

      Hi all: I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change? Nothend

      C Offline
      C Offline
      ChandruIT
      wrote on last edited by
      #2

      Hi Just share the same event for all the 100 TextBoxes. For example if you know the Text changed TextBox Name, private void textBox_TextChanged(object sender, EventArgs e) { TextBox txt = (TextBox)sender; MessageBox.Show("The Current TextBox is " + txt.Name); } All the TextBox's TextChanged events will share the above event.

      Cheers, Chandru.

      N 1 Reply Last reply
      0
      • N Nothend

        Hi all: I have a form which more than one hundred TextBoxes on it,if one of the TextBoxes is changed(for instance,change the Text of the Box),how can I know that change? Nothend

        Q Offline
        Q Offline
        quiteSmart
        wrote on last edited by
        #3

        use the TextChanged event of the textbox

        1 Reply Last reply
        0
        • C ChandruIT

          Hi Just share the same event for all the 100 TextBoxes. For example if you know the Text changed TextBox Name, private void textBox_TextChanged(object sender, EventArgs e) { TextBox txt = (TextBox)sender; MessageBox.Show("The Current TextBox is " + txt.Name); } All the TextBox's TextChanged events will share the above event.

          Cheers, Chandru.

          N Offline
          N Offline
          Nothend
          wrote on last edited by
          #4

          Thanks. but I'm sorry, as you said ,I will write 100 enents of XXX_TextChanged ? What I care is the change,if any of the TextBoxes is changed,I will set a boolean variable false.So how to achieve that?Thanks! Nothend

          S 1 Reply Last reply
          0
          • N Nothend

            Thanks. but I'm sorry, as you said ,I will write 100 enents of XXX_TextChanged ? What I care is the change,if any of the TextBoxes is changed,I will set a boolean variable false.So how to achieve that?Thanks! Nothend

            S Offline
            S Offline
            ShermansLagoon
            wrote on last edited by
            #5

            Write one forAll_TextChanged and add it to all textboxes. Can be done "manually": textBoXX.TextChanged += new System.EventHandler(forAll_TextChanged) or by selecting it in the TextChanged-dropdown for each text box in event-tab in VS (2005 at least). Note that you have to have the proper format of the forAll_TextChanged method.

            Internet - the worlds biggest dictionary

            N 1 Reply Last reply
            0
            • S ShermansLagoon

              Write one forAll_TextChanged and add it to all textboxes. Can be done "manually": textBoXX.TextChanged += new System.EventHandler(forAll_TextChanged) or by selecting it in the TextChanged-dropdown for each text box in event-tab in VS (2005 at least). Note that you have to have the proper format of the forAll_TextChanged method.

              Internet - the worlds biggest dictionary

              N Offline
              N Offline
              Nothend
              wrote on last edited by
              #6

              Thanks a lot ,it works!!! Nothend

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups