What is the code for Clearing ComboBox and adding Item to the Combobox?
Printable View
What is the code for Clearing ComboBox and adding Item to the Combobox?
Now, not wanting to take the piss, but if you add a combo box to your form, then in the code window type Combo1 then press the . (full stop) you will get a list of properties/methods.
Try it yourself, and see which properties you think may clear a combo box and add an item to a combo box :)
Woka
I've tried putting the "." but then...there isn't any suitable method that I can use.
You dont see combo1.additem or combo1.clear?
You sure you have a ComboBox on your form?
There is only
.Count
.Item
.LBound
.UBound
I'm very sure that it is ComboBox
What version of VB?
Zip up your project and upload it.
Is that VBA?
Right...u have a control array of combo boxes.
U copied and pasted a combo onto your form and when VB asked "Do you want to create a control array" you clicked yes.
This means that to get at the props/methods of a combo you would use combo.Item(2) or whatever the index value is of the combo box u want to use. Then press . and u will see all the mthods.
Woka
It's in a control array - muliple controls have the same name, and must be accessed via their Index.
If that isnt what you want, then just open the form in design view, select the control, and remove the value in the Index property. All will then be fine.
If you do want a control array, then you need to use the index, eg: Combo1(0).AddItem "test"