K keigo Active member Joined Oct 27, 2008 Messages 29 Programming Experience Beginner Nov 17, 2008 #1 I tried this PriceText.Text = $100 It could not build (build in error). Next I tried, PriceText.Text = PriceText.ToString(100) Neither worked. Can anyone help with this, please? Thank you.
I tried this PriceText.Text = $100 It could not build (build in error). Next I tried, PriceText.Text = PriceText.ToString(100) Neither worked. Can anyone help with this, please? Thank you.
jmcilhinney VB.NET Forum Moderator Staff member Joined Aug 17, 2004 Messages 15,176 Location Sydney, Australia Programming Experience 10+ Nov 17, 2008 #2 Assuming that you want to use the local currency format then you would do this: VB.NET: myTextBox.Text = myNumber.ToString("c") If you want to force no decimal places then you need to use "c0" instead. If you want to prepend a dollar sign no matter the local currency then you do just that: VB.NET: myTextBox.Text = "$" & myNumber Upvote 0 Downvote
Assuming that you want to use the local currency format then you would do this: VB.NET: myTextBox.Text = myNumber.ToString("c") If you want to force no decimal places then you need to use "c0" instead. If you want to prepend a dollar sign no matter the local currency then you do just that: VB.NET: myTextBox.Text = "$" & myNumber
K keigo Active member Joined Oct 27, 2008 Messages 29 Programming Experience Beginner Nov 17, 2008 #3 Thank you again, jmcilhinney. I have solved it using the last one you recommended. myTextBox.Text = "$" & myNumber Upvote 0 Downvote
Thank you again, jmcilhinney. I have solved it using the last one you recommended. myTextBox.Text = "$" & myNumber