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

Discussion in 'SolidWorks' started by SW Monkey, Jun 14, 2004.

  1. SW Monkey

    SW Monkey Guest

    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?
     
    SW Monkey, Jun 14, 2004
    #1
  2. 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
     
    Corey Scheich, Jun 14, 2004
    #2
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 (here). After that, you can post your question and our members will help you out.