Solved

VB6: One MDI form instance limitation

Posted on 2004-04-20
7
1,369 Views
Last Modified: 2012-05-04
I have a fairly complex project and need to instantiate more than one instance of the same MDI form at runtime. Is there any way to do this? The following works for SDI only.

Dim i As Integer
Dim frm As frmExplorer

For i = 1 to 5
    Set frm = New frmExplorer
    Call frm.Show
    Set frm = Nothing
Next
0
Comment
Question by:dnhughes
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 49

Assisted Solution

by:Ryan Chong
Ryan Chong earned 63 total points
ID: 10871344
There is only allow one instance of MDI form, you can create more that one instance of it..
0
 
LVL 6

Expert Comment

by:LunaSkye
ID: 10871386
Are you trying to make more than one instance of the parent MDI form? Or of a child?

I just tried this code..

'This is the load procedure for the PARENT mdi form
Private Sub MDIForm_Load()
    Dim Frm1 As frmTEST
    Dim Frm2 As frmTEST
   
    Set Frm1 = New frmTEST
    Set Frm2 = New frmTEST
   
    Frm1.Show
    Frm2.Show
End Sub


I end up wtih 2 of the same form sitting as children in the mdi parent form..

Is this what you want?
-Andrew
0
 

Author Comment

by:dnhughes
ID: 10871646
ryancys
  How?

LunaSkye
  I'm trying to create multiple parent MDI forms
Private Sub cmdCreateWindows_Click()
    Dim frmMDI1 As frmMDITEST
    Dim frmMDI2 As frmMDITEST
   
    Set frmMDI1 = New frmMDITEST
    Set frmMDI2 = New frmMDITEST
   
    frmMDI1 .Show
    frmMDI2 .Show
End Sub
0
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).

 

Author Comment

by:dnhughes
ID: 10871913
The error that I'm getting is when I try to create a second instance is:
Run-time error '426':

Only one MDI Form allowed
0
 
LVL 6

Accepted Solution

by:
LunaSkye earned 62 total points
ID: 10872095
DNHughes

This quote comes from VB Help:

"An application can have only one MDIForm object but many MDI child forms."

Maybe you could have multiple instances of your application?  or somehow move your functionality onto a child form?

Sorry im so general, i dont have alot of specifics to go on.

-andrew
0
 
LVL 4

Expert Comment

by:SSSoftware
ID: 10872962
For your information

I think
VB.Net allows multiple MDI Parents in an application.

Ed
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 10875943
>>There is only allow one instance of MDI form, you can create more that one instance of it..
typo, sorry, shoud be:
There is only allow one instance of MDI form, you can't create more that one instance of it..

SSSoftware is right, create multiple MDI form is allowed in vb.net, example:

Dim f As MDIForm = New MDIForm()
        f.Show()
        f.focus()
        f.BringToFront()
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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

757 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

19 Experts available now in Live!

Get 1:1 Help Now