Solved

How To Create Multiple Instances of the Same MDI Child Form

Posted on 2003-10-23
4
301 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

840 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