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. Textbox C#

Textbox C#

Scheduled Pinned Locked Moved C#
helpcsharpquestion
7 Posts 7 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.
  • O Offline
    O Offline
    OlieColie
    wrote on last edited by
    #1

    txtInterestRate.Text.ToString = 12; What am I doing wrong??? Im currently a student, trying to complete a task...and im stuck! The code is currently under a method in my application. Help Please Im trying to set the InterestRate textbox value to 12.

    C C A M T 5 Replies Last reply
    0
    • O OlieColie

      txtInterestRate.Text.ToString = 12; What am I doing wrong??? Im currently a student, trying to complete a task...and im stuck! The code is currently under a method in my application. Help Please Im trying to set the InterestRate textbox value to 12.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      OlieColie wrote:

      txtInterestRate.Text.ToString = 12; What am I doing wrong???

      Well, Text already returns a string, so there is no point in asking it to make a string from something that already is a string. It would be pointless. You want to make the number a string, so perhaps you might want to write 12.ToString(), but if you are dealing with literal values, why not just say "12" and be done with it.


      Upcoming FREE developer events: * Glasgow: db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

      1 Reply Last reply
      0
      • O OlieColie

        txtInterestRate.Text.ToString = 12; What am I doing wrong??? Im currently a student, trying to complete a task...and im stuck! The code is currently under a method in my application. Help Please Im trying to set the InterestRate textbox value to 12.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        You have asked this at least three times across at least two forums. Please ask once in the right forum, and leave it at that.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        1 Reply Last reply
        0
        • O OlieColie

          txtInterestRate.Text.ToString = 12; What am I doing wrong??? Im currently a student, trying to complete a task...and im stuck! The code is currently under a method in my application. Help Please Im trying to set the InterestRate textbox value to 12.

          A Offline
          A Offline
          Anthony Mushrow
          wrote on last edited by
          #4

          Indeed, only post once. Just to clarify, ToString() is a function that returns the value of an object, as a string, and it can't be set. The TextBox.Text property is all you need, it is the text of the text box, so you can either do txtInterestRate.Text = 12.ToString(); or simply txtInterestRate.Text = "12";

          My current favourite word is: Waffle Cheese is still good though.

          P 1 Reply Last reply
          0
          • A Anthony Mushrow

            Indeed, only post once. Just to clarify, ToString() is a function that returns the value of an object, as a string, and it can't be set. The TextBox.Text property is all you need, it is the text of the text box, so you can either do txtInterestRate.Text = 12.ToString(); or simply txtInterestRate.Text = "12";

            My current favourite word is: Waffle Cheese is still good though.

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            My favorite word is still Callipygian.

            1 Reply Last reply
            0
            • O OlieColie

              txtInterestRate.Text.ToString = 12; What am I doing wrong??? Im currently a student, trying to complete a task...and im stuck! The code is currently under a method in my application. Help Please Im trying to set the InterestRate textbox value to 12.

              M Offline
              M Offline
              Malcolm Smart
              wrote on last edited by
              #6

              Hi - I mean no disrespect to you in this post. 1 - you are a student, so I assume you are being 'taught'. 2 - the first chapter in most, if not all, C# beginner book handles strings, usually in the form string.Format("{0}" , 12) and, like the previous answers, obj.ToString(). 3 - are you paying for your course, and at what institution? 4 - Do you have any C# books? I can't believe, in all honesty, that a C# student, would not have been taught how to convert a number to a string. Seriously, how much are you actually taught, and how much are you left to figure out on your own, and are you given any learning material, or even any pointers on how to find out his info for yourself? Vote me down if you want, but this is not meant as abuse - just pure curiousity at what is being taught.

              "More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF

              "This time yesterday, I still had 24 hours to meet the deadline I've just missed today."

              1 Reply Last reply
              0
              • O OlieColie

                txtInterestRate.Text.ToString = 12; What am I doing wrong??? Im currently a student, trying to complete a task...and im stuck! The code is currently under a method in my application. Help Please Im trying to set the InterestRate textbox value to 12.

                T Offline
                T Offline
                taranjotk
                wrote on last edited by
                #7

                txtInterestRate.Text="12"; try this :)

                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