Solved

Runtime error 366 "No MDI form available to load

Posted on 2006-11-17
15
1,685 Views
Last Modified: 2008-01-09
I am using VS6 SP5. I have a simple form that I want to print that is too big to fit
on the entire page when printed, So, I found an article on the internet talking about using MDIChild forms to get around this MS limitation. I made my form a mdiChild form simplying by selecting True beside that value. I ran a test and it worked great, I closed the program , re-opened and now all I get is this error.
How do I set a MDI parent, what is an MDI Parent, just a container ?

Thanks.
0
Comment
Question by:ittechie100
  • 7
  • 5
  • 3
15 Comments
 
LVL 10

Accepted Solution

by:
Clif earned 250 total points
Comment Utility
You must add an MDI form to your project.

The MDI Parent is just a container where your child forms will appear.  (Well, it's a little more than "just a container", but that will suffice for now.)

Doing:

frmChild.Show

Will bring up the parent form with the child inside.
0
 
LVL 8

Expert Comment

by:drydenhogg
Comment Utility
The main MDI form (one per app) is the container for all the MDI child forms, you add them to a project in a variety of ways (Project Menu, Add MDI Form), or right click in the project explorer, sub menu add, sub option mdi form.

What seems strange is that you managed to get an mdi child to load without a parent container already being there. I'm unsure as to how you would of achieved that. when you look in your project explorer, do any of the forms have the mdi icon next to them (One large form and a small form icon next to it very greyed out)

To get that MDI child loaded in the first place, you would of needed a parent, so I think there is probably more info needed for this.

hth.
0
 
LVL 10

Expert Comment

by:Clif
Comment Utility
drydenhogg,
"To get that MDI child loaded in the first place, you would of needed a parent, so I think there is probably more info needed for this."
You can set a form's MDIChild property to True without the project containing an MDIParent form (I agree, you should not be able to do this, but you can).  Doing so, and trying to run the app, will give you the error ittechie100 points out.
0
 
LVL 8

Expert Comment

by:drydenhogg
Comment Utility
clif, compeltely agree but ittechie100 included 'I ran a test and it worked great,  I closed the program , re-opened and now all I get is this error.'

I'm wondering what test worked great at that point in time? No test of loading that form should of worked. It *could* of worked if there was an mdi parent in the project at the time which was not saved down, but thats pretty convoluted to be fair.
0
 
LVL 10

Expert Comment

by:Clif
Comment Utility
drydenhogg,

You're right, I missed that.  He (or she) couldn't have run it after changing a form to an MDIChild.
0
 

Author Comment

by:ittechie100
Comment Utility
These are the exact steps that took place:

My existing form that I was trying to print was named form5
I simply changed the MDIChild value to True, clicked
on "Play" if you will" to test it and the form opened via form5.Show (Yes it is greyed out
compared to the rest of my forms icon appearnaces)
The report printed to by default printer just fine. I then stopped
it, saved it, closed and re-opened the project and that is when I started
receiving that error.

At this point, I just need to create a new form? How do you tell it that it is a MDI parent form? I have no more MDI Child forms, only this one.
0
 

Author Comment

by:ittechie100
Comment Utility
Clif:
I added a MDI form, I set it's property to show children. Run the program
and only the new MDI form appears.

Code is form5.show (Child form), however as i said above only the new MDIform
appears (MDIForm1)
0
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

 
LVL 10

Expert Comment

by:Clif
Comment Utility
An MDI form is different than a "normal" form.

Click the (VB IDE) menu option "Project".  You will se the first two items are "Add Form" and "Add MDI Form".  Select the second on to add an MDI Parent to your project.

0
 
LVL 10

Expert Comment

by:Clif
Comment Utility
Hmm...  Not sure.

It should work (indeed, it works for me).

Not sure what you meant by "I set it's property to show children".  The only property like that is "AutoShow Children", and it defaults to True, so you wouldn't have set it.
0
 

Author Comment

by:ittechie100
Comment Utility
I'm sorry, for some reason it took a few minutes before it started working. The correct form
is now showing, however it is appearing just as the orginal regular form did and is cutting
thre bottom of the page off when printing. When I first created the MDIChild it printed great, the entire form instead of just what could be seen. Is there any other properties that should be changed to acheive this ?
0
 
LVL 10

Expert Comment

by:Clif
Comment Utility
I'm not sure what your initial "fix" said.  Perhaps you should re-read it.

I can't think of any properties that one would set in eith a parent or a child form which would fix a form print that is too big for the printer page.

Finally, It's rather odd that you were able to run your test initially.  An MDIChild form cannot exist without an MDIParent form and you should have received an error (as you did later), when you tried to run your app.
0
 

Author Comment

by:ittechie100
Comment Utility
The problem was that the entire form would only print when the screen resolution was set to 1152X864, Most of my users screen sizes are 1024X768. So they cannot view the entire form, nor print it. The fix I found on the web said that when you create a mdi child that it's properties would display more that it;s parent, and the guy in fact said it corrected his issue. I still have the test page that printed great. I am not sure what happened either, but now I cannot see the entire form ... ??
0
 
LVL 8

Expert Comment

by:drydenhogg
Comment Utility
Im with clif on this one, cant see how the initial test ran successfully if it was a child.
0
 

Author Comment

by:ittechie100
Comment Utility
So, In a nutshell, no one thinks this will work ?
0
 
LVL 10

Expert Comment

by:Clif
Comment Utility
I didn't say it wouldn't work.  I said I couldn't think of how it could work.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

762 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