-
See all form names
I know this/similar question has been asked a while back, so please excuse.
I was wondering if it is possible to add all forms names into a combo box.
at first i started with:
for i = 0 to vb.forms.count
combo1.additem form.name
next i
the problem is this only works with forms in the current collection which is only the forms that have been loaded.
I also thought of somehow use project1.(a list of forms appears) and then somehow going through and adding them - but could't figure it out.
someone suggessted that i add all forms to a class and then add a property to that class (or somethig like that) but I really don't know how to do that; help?
-Doug
the ansewer to life is 42
-
Why can't you just load the form names into the combo box at design time?
-
i could. But i don't want to do that; I have around 40-50 forms and ( i know that would only take a minute or two) everytime i change a formname (due to managment) or add/remove a form i don;t wont to chnage the code.
-Doug
-
Hi,
I am not aware of any way to obtain a list of all forms in your current project thru the VB programming interface ... perhaps tho, you can create an Add-In to populate the combobox at design.
I have never created a VB Add-In before, so I cant help you out except to suggest searching this forum for help on writing Add-Ins.
The only other option I can think of, would be to write some code to process the VB project file, and extract a list of forms (it contains form name and file in .vbp file), and generate some code from that to add to your code at design time (it at least makes your life easier maintaining the list of forms to add to your combobox).
Hope this helps.
Tinbum747