Solved

How To Create Multiple Instances of the Same MDI Child Form

Posted on 2003-10-23
4
300 Views
Last Modified: 2008-03-04
Firstly I am v new to vb programming so excuse any misspelling or incorrect terminology.

I have written an application that requires me to use the multiple instances of the same MDI child form. Vb will not allow me to do this and I can not have two forms with the same name.
Is there some way of creating a control array of forms or build a new form as a response to a user activating a control?

I would like to be able to click on a toolbar button and if the child form already exists launch a new one whilst retaining the original from and all of its contents.

I hope this makes sense.

Rgds

Rich

0
Comment
Question by:r_mclaughlin2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:NeXus
ID: 9605247
Sorry only one MDI form is every allowed.

but you can create multiple instances of an application...
so in response to a toolbar click do:

shell "myMDIFormApp.exe /Lform1;form2;form3"

contents could be populated via the command line that you would parse in your program...

Hope that helps
NeXus
0
 
LVL 2

Accepted Solution

by:
nahumd earned 100 total points
ID: 9605314
You can create more than one instance of MDI child form.
Just do the following:

dim new_form as Your_MDIChildForm
set new_form = new MDIChildForm
new_form.show
0
 

Author Comment

by:r_mclaughlin2
ID: 9605521
nahumd

Thanks for the help it works!  Any suggestions about managing the scope of the values would be good!
0
 
LVL 2

Expert Comment

by:nahumd
ID: 9605648
If you need to keep a reference of the variable (for example: if you need to distinguish this special child form from the others), you can declare it globally and keep it as long as your application is running (and remember to set it to nothing when the form is unloaded). Otherwise, you may declare it inside a function/sub and then it is freed automatically when the function exits. The form will continue to exist.
Also, there is a special collection that is handled automatically for you and it holds all the forms that currently exists. You can refer to it from anywhere in your application from the "forms" variable.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
consolidate or create a new vba code for performing tasks 5 66
VB error "Type mismatch" 2 55
Macro which automatically sends attachment to Outlook 14 69
TT Auto Dashboard 13 92
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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