Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How To Create Multiple Instances of the Same MDI Child Form

Posted on 2003-10-23
4
Medium Priority
?
307 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
[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
  • 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 300 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

Independent Software Vendors: 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

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…
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…
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…
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…
Suggested Courses

604 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