formating a number

  • Thread starter Thread starter Seth Broomer
  • Start date Start date
S

Seth Broomer

i have a stupid question i have a string 123456

i need to format it before i out put it.

i have tried
String.Format("{0:#,#####}","123456")



but i don't get the 123,456



what am i doing wrong?

thanks
 
Thats because 123456 is a string and that format only works on numbers.

You can either put the thusands separator in manually or you can convert the
string to anumber before passing it.

see Int32.Parse() or what ever numeric datatype works for your situation.

HTH
Brian W
 
Hi Seth,

Try it like this?

Label1.Text = String.Format("{0:#,#####}",
Convert.ToInt32("123456"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top