?
Solved

How To Create Multiple Instances of the Same MDI Child Form

Posted on 2003-10-23
4
Medium Priority
?
306 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
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 Month13 days, 7 hours left to enroll

801 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