How can I display 0s in a textbox (API)

Jun 14, 2004 1 Replies

I have a textbox, which changes depending on what size is selected in a combobox. The size is displayed as 1.1 rather than 1.100. I want the 0s to be displayed. How can I do this?


Look up Format in the VB help here is a working example

Dim mystr As String Dim MyNum As Long MyNum = 1.1 mystr = Format(MyNum, "0.000", Empty, Empty) UserForm1.TextBox1 = mystr

After you do this you can use UserForm1.TextBox1.Value as a double or long or int as you desire. you don't have to keep the MyNum value around.

Corey

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required