Trailing Zeros

A

aftamath77

I'm designing a combobox with decimal numbers. When I use .additem and type
in the numbers, it drops the trailing zeros. (ie. 0.500 becomes 0.5
automatically) I need the zeros for precision and consistancy purposes. Is
there a line I can include in this code?

With ComboBox1
.ListRows = 20
.AddItem (0.375)
.AddItem (0.5)
.AddItem (0.75)
End With
 
D

Dave Peterson

Since they're text in the combobox, just add them as text:

With ComboBox1
.ListRows = 20
.AddItem "0.375"
.AddItem "0.500"
'or even
.AddItem format(0.75,"0.000")
End With
 
A

aftamath77

Thanks Dave. "The simplest answers..."

Dave Peterson said:
Since they're text in the combobox, just add them as text:

With ComboBox1
.ListRows = 20
.AddItem "0.375"
.AddItem "0.500"
'or even
.AddItem format(0.75,"0.000")
End With
 

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

Top