Textbox C#
-
-
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.
OlieColie wrote:
txtInterestRate.Text.ToString = 12; What am I doing wrong???
Well,
Text
already returns astring
, so there is no point in asking it to make astring
from something that already is astring
. It would be pointless. You want to make the number a string, so perhaps you might want to write12.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
-
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.
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 )
-
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.
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.
-
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.
My favorite word is still Callipygian.
-
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.
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."
-
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.