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. computing the numeric value of 2 textbox without triggering with a button? (Windows Application)

computing the numeric value of 2 textbox without triggering with a button? (Windows Application)

Scheduled Pinned Locked Moved C#
4 Posts 3 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.
  • I Offline
    I Offline
    icesha
    wrote on last edited by
    #1

    Hello.. Example: there are 2 textbox, where i'll type a numeric value this is the value in the first 2 textbox, textBox1=500 textBox2=1000 then in textBox3 the sum of the 2 values in the textbox should be automatically generated without triggering it with a button. Example, i just finish typing those numbers and when i'll press tab in my keyboard, texBox3 should display=1500 how will i code it? thanks.

    R 1 Reply Last reply
    0
    • I icesha

      Hello.. Example: there are 2 textbox, where i'll type a numeric value this is the value in the first 2 textbox, textBox1=500 textBox2=1000 then in textBox3 the sum of the 2 values in the textbox should be automatically generated without triggering it with a button. Example, i just finish typing those numbers and when i'll press tab in my keyboard, texBox3 should display=1500 how will i code it? thanks.

      R Offline
      R Offline
      rah_sin
      wrote on last edited by
      #2

      private void textBox2_Leave(object sender, System.EventArgs e) { textBox3 = Convert.ToString( Convert.ToInt64(textBox1.Text)+Convert.ToInt64( textBox2.Text)); }

      rahul

      P 1 Reply Last reply
      0
      • R rah_sin

        private void textBox2_Leave(object sender, System.EventArgs e) { textBox3 = Convert.ToString( Convert.ToInt64(textBox1.Text)+Convert.ToInt64( textBox2.Text)); }

        rahul

        P Offline
        P Offline
        PS Codeproj
        wrote on last edited by
        #3

        The above function is not a correct one... It ll give an error "Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox'". To correct that, assign the converted string to the textbox3's text. textBox3.Text = Convert.ToString( Convert.ToInt64(textBox1.Text)+Convert.ToInt64( textBox2.Text));

        Thanks & Rgds, Sri..

        R 1 Reply Last reply
        0
        • P PS Codeproj

          The above function is not a correct one... It ll give an error "Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox'". To correct that, assign the converted string to the textbox3's text. textBox3.Text = Convert.ToString( Convert.ToInt64(textBox1.Text)+Convert.ToInt64( textBox2.Text));

          Thanks & Rgds, Sri..

          R Offline
          R Offline
          rah_sin
          wrote on last edited by
          #4

          That is just a question of common sense:confused:

          rahul

          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