|
-
Jul 18th, 2005, 12:55 PM
#1
Thread Starter
Lively Member
Child Form thing
Hi Folks,
I have several forms as part of a project. When I began this project, I didn’t know any better, but now I’ve discovered the application needs to be MDI capable.
Essentially, several of the data entry parts of most forms need to be handled a bit differently to validate the entry. A Message Box or Input Box would not be sufficient so I have had to make a small specific form that would be a child to all the others.
Trouble is: I have made no provision anywhere in the code to allow one form to be a child of another… perhaps better said “no provision for any of the forms to be child aware”.
In any event, I use this code: frmCustCmb.Show vbModal, Me to call up that little verification form but receive an error
No MDI form available to load (Error 366)
and I know that frmCustCmb.MDIchile=True
So I have a couple of questions about this “child form” stuff:
(1) How do I tell the parent form, in this case frmCustomer that it is a parent, and should let the child work?
(2) The start-up object for this application is a sub Main(). What ought I do to convert the whole thing to an MDI capable app?
Many thanks
-Paul-
-
Jul 18th, 2005, 01:16 PM
#2
Re: Child Form thing
You need to add an MDI Parent Form to your project (Project -> Add MDI Form menu item). A project can have only one MDI form. All other forms whose MDIChild property is set to True will automatically be "contained" within the MDI Form. There are some things you should be aware of when switching to an MDI Form.
Child Forms cannot be shown modally.
Menus on Child forms replace the menu on the MDI Form (when the child becomes active).
The Child form's Height and Width properties, as set at design time, are ignored in an MDI application.
There will be more...
-
Jul 18th, 2005, 02:09 PM
#3
Thread Starter
Lively Member
Re: Child Form thing
Yeeeech!
I didn't know it would be complicated like this.
Is there another way that I can use a "form" as a fancier input box? I do need to limit the data entry to tw0 characters.
Thanks Paul
-
Jul 18th, 2005, 03:10 PM
#4
Re: Child Form thing
This code (with MDIChild = False)
frmCustCmb.Show vbModal, Me
basically does create a parent/child relation. Since the form is Modal, it must be closed before any other Form can become active. Since you specified Me for the second argument (Owner), "Me" is its Parent form.
-
Jul 18th, 2005, 04:48 PM
#5
Thread Starter
Lively Member
Re: Child Form thing
Thanks brucevde,
It works like a charm. One question I hadn't thought about when I began this would be how to "exit" that wee form and return to the parent?
How do I do that?
Thanks
-Paul-
-
Jul 18th, 2005, 05:03 PM
#6
Re: Child Form thing
Typically, a modal form has an Ok or Cancel button (or whatever name is appropriate for your app). In the Click event of these buttons execute
Unload Me
or
Me.Hide
-
Jul 18th, 2005, 05:11 PM
#7
Re: Child Form thing
One way to simulate a modal form in a MDI application is to set the other form(s) Enabled property to False when the "modal" for is shown.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|