Solved

How To Create Multiple Instances of the Same MDI Child Form

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

707 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

15 Experts available now in Live!

Get 1:1 Help Now