Solved

Multiple instances of a form?

Posted on 2004-09-12
4
266 Views
Last Modified: 2010-05-02
Is it possibvle to have multiple instances of the same form in a project? Can I program one mdi child form so that i can call it to spawn multiple instances with different variables inside the main form? Thanks.
  - Dave
0
Comment
Question by:User501
4 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 225 total points
ID: 12041005
After you create the first child form, you can do:

'assuming the child form name is Form1

Dim myForm As Form1
Set myForm = New Form1
myForm.Show


S
0
 
LVL 10

Expert Comment

by:anv
ID: 12041095
hi User501.

yes u can have multiple instances of the same form using
the above code as givn by Shauli...

but when u say with different varaibles..what exactly u mean..

if u mean that the variables should store separate values for all instances.. then yes they will..

and if u mean u want to run different code depending on the instance or value passed while opening a form...then for that u can take a variable say OpenArgs.. depending on the value of this variable u can call ur code..

like
frm.OpenArgs = "1"
frm.show
in the form load of form1 wriet the following code

Select case OpenArgs
 case "1": 'do something
 Case "2"" Do Something
and so on..
end select
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12041454
u cannot have multiple instances of a mdi form .. but u can have multilpe instances of a normal form using the example that shauli menions above
0
 
LVL 3

Assisted Solution

by:redfordb
redfordb earned 25 total points
ID: 12041707
Remember that once you are finished with the form you need to free the memory that it was using.
ie Set myform = nothing.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

708 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

12 Experts available now in Live!

Get 1:1 Help Now