Solved

Load all forms

Posted on 1998-09-15
8
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

617 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