Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6: One MDI form instance limitation

Posted on 2004-04-20
7
Medium Priority
?
1,385 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
[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
  • 2
  • 2
  • +1
7 Comments
 
LVL 53

Assisted Solution

by:Ryan Chong
Ryan Chong earned 189 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 186 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 53

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses

704 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