Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Visual C# Question: Displaying Numbers in a Textbox
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rar




PostPosted: Mon Jun 28, 2010 10:51 am   Post subject: Visual C# Question: Displaying Numbers in a Textbox

So I'm learning C# using Visual C# and I've been trying to display numbers in a textbox. Every time I do it, however, I have to convert a float to a string somehow and it just becomes a hassle. Isn't there an easier way to do this?
Sponsor
Sponsor
Sponsor
sponsor
TerranceN




PostPosted: Mon Jun 28, 2010 11:08 am   Post subject: Re: Visual C# Question: Displaying Numbers in a Textbox

You HAVE to convert to string. I don't know how you're converting, but I have never found this to be a hassle:
code:
float number = 5.346f;
textBox1.Text = number.ToString();


Hope that helps.

Also does anyone know the name of the C# code tags (if there is any)? What I mean is like how you have to put "turing" for Turing and "cpp" for C++, so what do you have to put for C#?
rar




PostPosted: Mon Jun 28, 2010 11:18 am   Post subject: Re: Visual C# Question: Displaying Numbers in a Textbox

TerranceN @ Mon Jun 28, 2010 11:08 am wrote:
You HAVE to convert to string. I don't know how you're converting, but I have never found this to be a hassle:
code:
float number = 5.346f;
textBox1.Text = number.ToString();


Hope that helps.

Also does anyone know the name of the C# code tags (if there is any)? What I mean is like how you have to put "turing" for Turing and "cpp" for C++, so what do you have to put for C#?


I figured out my problem. For the second time now, I made the error of just writing ToString instead of ToString(). Thanks!
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: