Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding items to combobox

Status
Not open for further replies.

rds747

Technical User
Mar 8, 2005
180
US
Hi,

I have two arrays that holds integers (min(i) and max(i)) and I want to add these integers as the items in my combobox. If anyone can tell me the correct way to code this:
Code:
for i = 0 to max
cbobox1.AddItem (min(i)...max(i))
next

Thanks!
 
Assuming you are using the standard combobox from VB6, if you select the control while on the form, and then hit F1 you get to the help of that control.

When in there click on the "methods" link, select the "AddItem" method, and then on the "Example" link.

You will then find an example of how to add items to a combobox.

If your problem on the other hand is how do to loop on a array then search these forums for
("for" or "while") and "ubound"

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
I believe it to be a standard combobox (MWC Controls 6.0). My question is more on which method I can use to add the values, from my arrays, to the list in the combobox.

I tried searching on the method (as how you suggested), but it didn't quite help me.

Thanks.
 
Difficult to see what we can add.... The AddItem method is clearly documented in VBHelp with a simple example. Which part of the Help page is not clear?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Using MyItem() as an example:

Code:
Dim X as Integer
Dim MaxItem as Integer
MaxItem = Ubound(MyItem)
for X = 0 to MaxItem
  combo1.additem MyItem(X)
next X

David
 
The answer I was looking for was:

Code:
for i = 0 to max
cbobox1.AddItem (min(i) & "-" & max(i))
next

Sorry for the vague question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top