decimal numbers in a listbox

  • Thread starter Thread starter Southern at Heart
  • Start date Start date
S

Southern at Heart

I have a listbox with a row source type a 'value list'. the list is:
..25
..5
1
5

My problem is this line:
intNumber = me.listbox.value

....if 1 or 5 was chosen, it works fine, if not, then intNumber is zero. I
need to do some calculations with this number...
How do I fix this problem?
thanks.
 
Looks like intNumber is declared as an integer. To pick up the 0.25 or 0.5 it
needs to be a single-precision floating-point declaration, so decalre as
follows:

Dim intNumber as Single
 
I have a listbox with a row source type a 'value list'. the list is:
.25
.5
1
5

My problem is this line:
intNumber = me.listbox.value

...if 1 or 5 was chosen, it works fine, if not, then intNumber is zero. I
need to do some calculations with this number...
How do I fix this problem?
thanks.

An integer is, by definition, a whole number. If you don't want intNumber to
be a whole number, dim it as a more appropriate datatype - Single, Double,
Decimal or Currency.
 
Back
Top