Jason
asked on
Combobox formular for form load
I am after formula help
I have a combobox and i need it to list currency in increments of 10 cents
I have this
Dim h
Dim h1 As String
For h = 1 To 50
h1 = h + 0.1
cboMin.Items.Add("$" & h1)
cboMax.Items.Add("$" & h1)
Next h
But the results of this is
$1.1
$2.1
$3.1
etc
What I need is
$1.10
$1.20
$1.30
etc
The formula need to start from $1.00 up to $5.00
I have a combobox and i need it to list currency in increments of 10 cents
I have this
Dim h
Dim h1 As String
For h = 1 To 50
h1 = h + 0.1
cboMin.Items.Add("$" & h1)
cboMax.Items.Add("$" & h1)
Next h
But the results of this is
$1.1
$2.1
$3.1
etc
What I need is
$1.10
$1.20
$1.30
etc
The formula need to start from $1.00 up to $5.00
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thks
You're welcome, but I think that you really need is this:
Dim h1 As Decimal = 1
Dim txt As String
Do While h1 <= 5
cboMin.Items.Add("$" + h1.ToString("N"))
cboMax.Items.Add("$" + h1.ToString("N"))
h1 += 0.1
Loop
Ignore line #2
ASKER
yv989c:
Thanks I just added an if statement in to handle the > $1
So all good thks for your help
Thanks I just added an if statement in to handle the > $1
So all good thks for your help
Open in new window