dear,
how to add the item
this code cannot do that.Code:combobox1.AddItem "1"
Printable View
dear,
how to add the item
this code cannot do that.Code:combobox1.AddItem "1"
Hi,
Check whether the name of your combo box is combobox1.
The default name is Combo1.
To add with it, use
Code:Combo1.AddItem "1"
thank you. but i rename the combobox as combobox1, and want to add a new item to exsiting items. but use such code cannot archieve that, help me.
Hi,
Post your project here.
Hi
Just tried it out, works fine.
CheersCode:
Dim j as integer
Private Sub Form_Load()
Combobox1.Clear
For J = 1 To 10
Combobox1.AddItem J
Next J
Combobox1.Text = Combobox1.List(0)
End Sub
Karsten
Hi Karsten!:wave:Quote:
Originally Posted by liuyang
I noticed 2 things in your code:
1) You do not need to clear the combobox at form load - Form Load is fired when your form gets loaded into memory, so you can see Form Load as the firts event that fires for your form (in this case)
2) I also see that your For Loop starts at 1. Combobox's ListIndexes are 0 based, meaning that the first item in a combobox is 0, not 1 - so if you want to add 10 items to your combobox, you can start the loop at 0, and end it at 9.
just my 2 cents..