
-----------------------------------
rar
Mon Jun 28, 2010 10:51 am

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?

-----------------------------------
TerranceN
Mon Jun 28, 2010 11:08 am

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();[/code]

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
Mon Jun 28, 2010 11:18 am

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:


I figured out my problem. For the second time now, I made the error of just writing ToString instead of ToString(). Thanks!
