Solved

Load all forms

Posted on 1998-09-15
8
153 Views
Last Modified: 2010-05-03
I have an MDI form and about 70 forms in it (Yes i know i'm crqzy) the story is that i need to load all of them at start up or a method to refare to them even when they are not loaded, The Forms collection contain only loaded forms and i realy dont want to start typing 70 lines of load X, Load Y, Load M etc.
I need an answer ASAP, Please my job depends on it, Thank you.
0
Comment
Question by:DarkAge
8 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1435024
One solution is naming your forms mdiChild(0) ... mdiChild(69)
and do
 for  nI = 0 to 69
    Load mdiChild(nI)
 Next
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1435025
I think that "70 lines of load X, Load Y, Load M" may be the only way out. How can the app know the list of forms that you want until it's told?

You might be able to make a data structure in a disk file or something with the list of forms to load, but that is cumbersome. You CAN load a form from a variable.

'Form1 Code:
Private Sub Form_Load()
    Text1.Text = "Form2"
End Sub

Private Sub Command1_Click()
    LoadFormByName Text1.Text
End Sub

Private Sub LoadFormByName(sFormName As String)
    Dim NewForm As Form
    Set NewForm = Forms.Add(sFormName)
    NewForm.Show
End Sub

You still have the problem of generating the list of forms to load. Maybe you could make a copy of the .VBP file and use that?

M
0
 

Expert Comment

by:idcjavateam
ID: 1435026
We normaly use a the form.count method to unload all forms.
I do suppose, that you could use it to load them all.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:mark2150
ID: 1435027
He can't use form.count as the count is zero/one since they haven't been loaded yet!
0
 
LVL 1

Author Comment

by:DarkAge
ID: 1435028
I cant give a form name with ( ), Sorry
0
 
LVL 1

Author Comment

by:DarkAge
ID: 1435029
Hey mark2150, U'r answer is the one and it's wounderfull thanks, But it looks like it's locked for the other one who was mistaken, I want to grant you the points, You realy saved my neck man, thanks - How can i unlock it and give you the points?

0
 
LVL 12

Accepted Solution

by:
mark2150 earned 220 total points
ID: 1435030
Easy enough - gimme the points for *this* answer (grin!)
M
0
 
LVL 1

Author Comment

by:DarkAge
ID: 1435031
Ten Four, Out.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question