Solved

Load all forms

Posted on 1998-09-15
8
148 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now