By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Formatting textboxes in VB.NET

P: n/a
It looks like the Format method is another one that didn't make it to the
..NET controls. Since I need to force a decimal placeholder to values going
into the textboxes, I tried the following code:

Temp1D_textbox.Text = Format("{0:F1}", dcon_x4.AnalogIn)

If I understand correctly, this should force one number to the right of the
decimal, even if it's zero, which is what I want. However, zeroes don't show
up; the numbers are truncated as if the formatting wasn't there.

I've also tried other format strings, such as:

Temp1D_textbox.Text = Format("{0:###.0}", dcon_x4.AnalogIn)

....but nothing makes any difference.

Any ideas on how to accomplish this? Searches have turned up nothing so far.

Thanks,

Randall Arnold
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Oops, nevermind, I just figured it out. My code needs to include the String
method (prior to Format), as shown below:

Temp1D_textbox.Text = String.Format("{0:F1}", dcon_x4.AnalogIn)

Sorry!

Randall Arnold

"Randall Arnold" wrote:
It looks like the Format method is another one that didn't make it to the
.NET controls. Since I need to force a decimal placeholder to values going
into the textboxes, I tried the following code:

Temp1D_textbox.Text = Format("{0:F1}", dcon_x4.AnalogIn)

If I understand correctly, this should force one number to the right of the
decimal, even if it's zero, which is what I want. However, zeroes don't show
up; the numbers are truncated as if the formatting wasn't there.

I've also tried other format strings, such as:

Temp1D_textbox.Text = Format("{0:###.0}", dcon_x4.AnalogIn)

...but nothing makes any difference.

Any ideas on how to accomplish this? Searches have turned up nothing so far.

Thanks,

Randall Arnold

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.