HI all
Can anyone tell me how do i use vb to add items in the dropdown box as i am
making a form and using control toolbox to create a drop down.
please Help!!!!!!!!!!!!

Re: how do i add items in the drop down box using Visual basic? by LEC

LEC
Tue Nov 15 15:53:11 CST 2005

Hi there -
Is this what you are looking for?
Private Sub UserForm_Initialize()
ComboBox1.AddItem "A"
ComboBox1.AddItem "B"
ComboBox1.AddItem "C"
ComboBox1.AddItem "D"
ComboBox1.AddItem "E"
ComboBox1.AddItem "F"
End Sub

HTH
Lorraine


Re: how do i add items in the drop down box using Visual basic? by mita

mita
Wed Nov 16 16:07:31 CST 2005

Thanks a bunch for replying LEC....
ya it is wat im lookin for ..however i dont know much about vb..so if i m
using word for making forms where do i insert this code which u hav given
me?????..by double clicking the combo box and just adding the code??? correct
me if i m wrong
please help


cheers
mita
"LEC" wrote:

> Hi there -
> Is this what you are looking for?
> Private Sub UserForm_Initialize()
> ComboBox1.AddItem "A"
> ComboBox1.AddItem "B"
> ComboBox1.AddItem "C"
> ComboBox1.AddItem "D"
> ComboBox1.AddItem "E"
> ComboBox1.AddItem "F"
> End Sub
>
> HTH
> Lorraine
>
>

Re: how do i add items in the drop down box using Visual basic? by LEC

LEC
Wed Nov 16 18:07:09 CST 2005

Hi Mita,
You can double click on the combobox. That will get you to the view
code window and the change event for the combobox. You want to put
this code in the User Form Initialize event. So when you double click
on the combobox you will see something like:

Private Sub Comboxbox1_Change()

End Sub

You don't want to put the code here. You need to change to the user
form initialize event. To do this you would select the left dropdown
box (this is where all the objects on your form are). Select User Form
(its at the very bottom). Once you select the user form your object
drop down should say User Form. In the right drop down box, select
"Initialize" (if it is not already selected) . Now in the code window
you should see.

Private Sub UserForm_Initialize()
' Put the code for the combobox here.
End Sub

I have indicated above where the code should go.

HTH

LEC