I am new to using Userforms in my templates. I am trying to build one
that contains some listbox controls, but can't find out any info on how
to populate the lists.
I have the userform open and i click on the listbox control in my
toobox and place it on the userform. I can't directly add anything into
the control, nor will it let me enter anything into the "Value" field.
"Help" is useless, as usual. Can some one point me to a useful
tutorial? TIA
>I am new to using Userforms in my templates. I am trying to build one
> that contains some listbox controls, but can't find out any info on how
[quoted text clipped - 5 lines]
> "Help" is useless, as usual. Can some one point me to a useful
> tutorial? TIA
Hi Lighthouse
Yiou have to populate the listbox with code. The simplest approach is to
include something like this in the UserForm_Initialize event of your form
ListBox1.List = Array("Joe", "Fred", "Bill", "Mike")

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
Lighthouse - 21 Mar 2005 19:34 GMT
Jonathan, where do I find this "UserForm_Initialize" event or do i have
to create it somehow? Sorry if this sounds like a simpleton question.
When I dbl-click on the list box I get put into the code view for
Private sub listbox click (). I don't think I want to be there.
Jonathan West - 21 Mar 2005 19:40 GMT
> Jonathan, where do I find this "UserForm_Initialize" event or do i have
> to create it somehow? Sorry if this sounds like a simpleton question.
> When I dbl-click on the list box I get put into the code view for
> Private sub listbox click (). I don't think I want to be there.
Open the code window for the userform. In the left-hand dropdown box aboive
the code windows, select "UserForm". Then in the right dropdown, select
Initialize.
The following will be placed into the main code window
Private Sub UserForm_Initialize()
End Sub
Put your code between those two statements

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
Lighthouse - 21 Mar 2005 21:36 GMT
not sure what's up w/ 'groups'. i replied to this a while ago and
haven't seen it show up yet. sorry if this is a dupe.
Jonathan, thanks for your answer, but WHERE do I find this
"UserForm_Initialize" event or do I have to create it myself. If I need
to create it, where and how do I do that? Sorry if this is a simpleton
question, but my knowledge of userforms is in its infancy.
Deb - 19 Apr 2005 17:30 GMT
I am a newbie with a question about my form. I populate my combobox
using this code;
cmboBusGroup.List() = Array("Brecksville", "Chicago", "Ritterhude")
What do I need to add so that in the future the user can add to the
list themself? For example, if the user wants to add "London" I would
like to have the user click a button (or something) to "Add BusGroup"
and add "London" without having to call me to add it in the code.
How do I do this?
Thank you!
Debbie