Filling a combobox with decimal numbers
Author Message
Filling a combobox with decimal numbers

I am trying to fill 5 comboboxes with decimal numbers.
I have set the comboboxes in a control array from index 1 to 5.

Here's the code i have so far :

Dim Idx As Integer
Dim Kmt As Variant

For Idx = 1 to 5
For Kmt = 19.1 to 30.1
Next Kmt
Next Idx

This code doesn't work since i just get the whole number: 19.1 - 20.1 - 21.1 etc.
I want all the numbers from 19.1 to 30.1 : 19.1 - 19.2 - 19.3 etc.

If someone can help me with this, It would be appreciated.

Kris D.

Sun, 24 Dec 2000 03:00:00 GMT
Filling a combobox with decimal numbers
Dim Idx As Integer
Dim Kmt As Variant

For Kmt = 19.1 to 30.1 Step 0.1
For Idx = 1 to 5
Next Idx
Next Kmt

Quote:

>I am trying to fill 5 comboboxes with decimal numbers.
>I have set the comboboxes in a control array from index 1 to 5.

>Here's the code i have so far :

> Dim Idx As Integer
> Dim Kmt As Variant

> For Idx = 1 to 5
> For Kmt = 19.1 to 30.1
> Next Kmt
> Next Idx

>This code doesn't work since i just get the whole number: 19.1 - 20.1 -
21.1 etc.
>I want all the numbers from 19.1 to 30.1 : 19.1 - 19.2 - 19.3 etc.

>If someone can help me with this, It would be appreciated.

>Kris D.

Sun, 24 Dec 2000 03:00:00 GMT
Filling a combobox with decimal numbers

In 'For...Next' statements, the default increment is '1'.

If you want to use anything else, you have to state it using 'Step'.
Your code should look like this...

Dim Idx As Integer
Dim Kmt As Variant

For Idx = 1 to 5 Step 0.1
For Kmt = 19.1 to 30.1
Next Kmt
Next Idx

Have a look in Help for more details

Mianne

Quote:

> I am trying to fill 5 comboboxes with decimal numbers.
> I have set the comboboxes in a control array from index 1 to 5.

> Here's the code i have so far :

>         Dim Idx As Integer
>         Dim Kmt As Variant

>         For Idx = 1 to 5
>                 For Kmt = 19.1 to 30.1
>                 Next Kmt
>         Next Idx

> This code doesn't work since i just get the whole number: 19.1 - 20.1 - 21.1 etc.
> I want all the numbers from 19.1 to 30.1 : 19.1 - 19.2 - 19.3 etc.

> If someone can help me with this, It would be appreciated.

> Kris D.

Mon, 25 Dec 2000 03:00:00 GMT
Filling a combobox with decimal numbers

Sorry, I put the 'Step' in the wrong For...Next loop.

In 'For...Next' statements, the default increment is '1'.

If you want to use anything else, you have to state it using 'Step'.
Your code should look like this...

Dim Idx As Integer
Dim Kmt As Variant

For Idx = 1 to 5
For Kmt = 19.1 to 30.1 Step 0.1
Next Kmt
Next Idx

Have a look in Help for more details

Mianne

Quote:

> I am trying to fill 5 comboboxes with decimal numbers.
> I have set the comboboxes in a control array from index 1 to 5.

> Here's the code i have so far :

>         Dim Idx As Integer
>         Dim Kmt As Variant

>         For Idx = 1 to 5
>                 For Kmt = 19.1 to 30.1
>                 Next Kmt
>         Next Idx

> This code doesn't work since i just get the whole number: 19.1 - 20.1 - 21.1 etc.
> I want all the numbers from 19.1 to 30.1 : 19.1 - 19.2 - 19.3 etc.

> If someone can help me with this, It would be appreciated.

> Kris D.

Mon, 25 Dec 2000 03:00:00 GMT
Filling a combobox with decimal numbers

Quote:

>I am trying to fill 5 comboboxes with decimal numbers.
>I have set the comboboxes in a control array from index 1 to 5.

>Here's the code i have so far :

>    Dim Idx As Integer
>    Dim Kmt As Variant

>    For Idx = 1 to 5
>            For Kmt = 19.1 to 30.1
>            Next Kmt
>    Next Idx

>This code doesn't work since i just get the whole number: 19.1 - 20.1 - 21.1 etc.
>I want all the numbers from 19.1 to 30.1 : 19.1 - 19.2 - 19.3 etc.

>If someone can help me with this, It would be appreciated.

>Kris D.

Try This ---

For Idx = 1 to 5
For Kmt = 19.1 to 30.1 step 0.1
Next Kmt
Next Idx

Barry
eggers1 AT tsil DOT net

Fri, 29 Dec 2000 03:00:00 GMT

 Page 1 of 1 [ 5 post ]

Relevant Pages