Formatting textboxes in VB.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 

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