QUOTE(bluesun011 @ 12 Mar, 2007 - 05:36 PM)

Im trying to add the numeric 1-14 to a drop down combo box. Even though it would probly be more efficent to do it throough the properities window. I want to be able to code it so that the numbers will be added through the code during the runtime of the program,
Thanks for any help
Okay, the cheapest (and the fastest) way would be to put Combobox1.AddItem "1" in form_load, but what if you need to change list, and refresh it during run-time?
Then the best thing to use would be the For-to loop...
In case you don't know how, I'll explain
CODE
Dim i as Integer 'The number that will change, with the loop
Dim Beginning as Integer 'The minimum number
Dim Ending as Integer 'The maximum number
For i = Beginning To Ending '(You can also add steps)
'statements
'statements
'statements
Next Beginning
Okay, so the easyest way to refresh (and fill) the list would be to use this loop, in a private sub. Private subs happen only if you call them, so this makes it perfect.
CODE
Dim i as Integer 'The same "i" as above
Private Sub RefreshCombo(Min as Integer, Max as Integer) 'We will use Min and Max when we call the sub, to assign the 'range of numbers the loop should put in list.
For i = Min to Max 'We now use the data we've given when calling the sub.
ComboBox1.AddItem i 'This will add the number to the combo box.
Next i 'End the statement, which continues the loop from the top, unless i = Max
End Sub
Now that we have our decleration, we might want to call it.
CODE
Private Sub Command1_Click(Button as integer, blah balh)
Call RefreshCombo (5,200) 'This calls our sub, givin it the attributes of 5 and 200
'In the loop we use those numbers as Min and Max, meaning that our loop will put all
' the numbers from 5 to 200 into the combo box
End sub
Well that's about it... I hope it helpes...