CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Location
    Boston, or Columbus
    Posts
    46

    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

  2. #2
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163
    Why can't you just load the form names into the combo box at design time?

  3. #3
    Join Date
    Jul 2003
    Location
    Boston, or Columbus
    Posts
    46
    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

  4. #4
    Join Date
    May 2003
    Location
    Australia
    Posts
    155
    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
    Zen-Programming:

    If a compiler beeps in the IDE forest, and nobody hears it, was there really a bug?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured