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. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved C#
14 Posts 5 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.
  • S Sun Rays

    Member 3499052 wrote:

    How can i calculate this text box. TextBox1.Text = "1+2+3"; to giv me int total = 6;

    Hi, you can do this with below code.. int i = 1+2+3; TextBox1.Text = i.ToString(); Hope it will help you.

    Thanks, Sun Rays To get something you must have to try once. My Articles

    B Offline
    B Offline
    Burim Rama
    wrote on last edited by
    #3

    thanks but i think we misunderstud i have a gridview where you can clik on row and the value of the row is typing in textbox like this this is a textbox.Text = 1+3+4+5+6. now a need a function to calculate that. i have this code int i = Convert.ToInt32(TextBox1.Text); Label1.Text = i.ToString(); But its not working ;-( Thanks very mutch..

    S 1 Reply Last reply
    0
    • B Burim Rama

      thanks but i think we misunderstud i have a gridview where you can clik on row and the value of the row is typing in textbox like this this is a textbox.Text = 1+3+4+5+6. now a need a function to calculate that. i have this code int i = Convert.ToInt32(TextBox1.Text); Label1.Text = i.ToString(); But its not working ;-( Thanks very mutch..

      S Offline
      S Offline
      Sun Rays
      wrote on last edited by
      #4

      Hi, first of all what are you diong ? what you wanna do its yet not clear.

      Member 3499052 wrote:

      textbox.Text = 1+3+4+5+6

      int i = 1+3+4+5+6; // you can calculate here textbox.Text =i.ToString(); // here you can convert i to string Now

      Member 3499052 wrote:

      int i = Convert.ToInt32(TextBox1.Text); Label1.Text = i.ToString();

      No need for this, Just write, Label1.Text = TextBox1.Text;

      Thanks, Sun Rays To get something you must have to try once. My Articles

      J 1 Reply Last reply
      0
      • S Sun Rays

        Hi, first of all what are you diong ? what you wanna do its yet not clear.

        Member 3499052 wrote:

        textbox.Text = 1+3+4+5+6

        int i = 1+3+4+5+6; // you can calculate here textbox.Text =i.ToString(); // here you can convert i to string Now

        Member 3499052 wrote:

        int i = Convert.ToInt32(TextBox1.Text); Label1.Text = i.ToString();

        No need for this, Just write, Label1.Text = TextBox1.Text;

        Thanks, Sun Rays To get something you must have to try once. My Articles

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #5

        He wants to write a calculator, where he can type into a textbox "1+2-3*4" and it does the calculating for him. ie/ you've totally misunderstood the point!

        S 1 Reply Last reply
        0
        • B Burim Rama

          [Message Deleted]

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #6

          You need an expression evaluator like this[^] one.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          B 1 Reply Last reply
          0
          • P Pete OHanlon

            You need an expression evaluator like this[^] one.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            B Offline
            B Offline
            Burim Rama
            wrote on last edited by
            #7

            thank you but how ? can you write a exampel ? thanks very mutch

            P 1 Reply Last reply
            0
            • B Burim Rama

              thank you but how ? can you write a exampel ? thanks very mutch

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #8

              If you'd followed the link you'd have found a whole article about one. I'm curious as to why you voted me down for pointing you towards the answer.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              B 1 Reply Last reply
              0
              • P Pete OHanlon

                If you'd followed the link you'd have found a whole article about one. I'm curious as to why you voted me down for pointing you towards the answer.

                Deja View - the feeling that you've seen this post before.

                My blog | My articles

                B Offline
                B Offline
                Burim Rama
                wrote on last edited by
                #9

                sorry i that it was a page list .. i wrote u up now.. sorry.. thanks very mutch

                P 1 Reply Last reply
                0
                • B Burim Rama

                  sorry i that it was a page list .. i wrote u up now.. sorry.. thanks very mutch

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #10

                  No problem - BTW, I really like that article which is why I pointed you to it. It's very good.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  B 1 Reply Last reply
                  0
                  • J J4amieC

                    He wants to write a calculator, where he can type into a textbox "1+2-3*4" and it does the calculating for him. ie/ you've totally misunderstood the point!

                    S Offline
                    S Offline
                    Sun Rays
                    wrote on last edited by
                    #11

                    Ohhhh, ya really man... :cool:

                    Thanks, Sun Rays To get something you must have to try once. My Articles

                    1 Reply Last reply
                    0
                    • P Pete OHanlon

                      No problem - BTW, I really like that article which is why I pointed you to it. It's very good.

                      Deja View - the feeling that you've seen this post before.

                      My blog | My articles

                      B Offline
                      B Offline
                      Burim Rama
                      wrote on last edited by
                      #12

                      sorry but i have no ide how its works.. i read the articel but i did't understand.

                      P 1 Reply Last reply
                      0
                      • B Burim Rama

                        sorry but i have no ide how its works.. i read the articel but i did't understand.

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #13

                        Include a reference to his assembly in your project and then do the following:

                        ExpressionEval eval = new ExpressionEval(txtFunction.Text);
                        object output = eval.Evaluate();
                        if (output != null)
                        {
                          // You have your answer. Do what you want with it.
                        }
                        

                        Deja View - the feeling that you've seen this post before.

                        My blog | My articles

                        1 Reply Last reply
                        0
                        • B Burim Rama

                          [Message Deleted]

                          P Offline
                          P Offline
                          Paul Conrad
                          wrote on last edited by
                          #14

                          Please don't delete your message once someone has replied. It kind of dirties the forums.

                          "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                          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