Question about MDI application

R

rhaazy

I have an MDI application with the MDI parent container has a
tabcontrol on it. When I bring up any child MDI forms, it won't show
up over the tabcontrol. I have tried the form.bringtofront() and that
doesnt work. Short setting the controls visible property to false, I
can not figure this one out. Anyone have any ideas????
 
A

Andy

MDI parent forms shouldn't have any controls like that placed on them;
at most, they should have menus and toolbar controls.

What are you trying to acomplish by having a tab control on the MDI
parent?

Andy
 
R

rhaazy

Well, my application is basically one form with a tabcontrol on it.
Each tabpage is a different "screen" if you will. The MDI children are
all for the purpose of adding or editing underlying data for the
database. Does it not make sense to do this??? Should I just call
the forms normally????
 
A

Andy

So you want the 'screens' to appear in the tabs? Can the tabs be
opened / closed independantly?

If you want a MDI form like VS2005, there are 3rd party controls which
can do this easily.

If the tabs are fixed, you should create a user control instead of a
mdi child form; you can then add the control to each tab page.

Andy
 
R

rhaazy

All I meant by screen was that each tabpage has a different set of
components on it. In retrospect, each tabpage COULD BE its own form.
But instead I decided to make it simple and use a tabcontrol. My MDI
child forms could pop up at about any time the user desires. I wanted
to use the MDI format to prevent the user from having more than one of
these forms open at a time. The Child forms are used for making
changes to the database. Is it a better idea to just use a form
without using parent child relations, and if so how would I prevent the
user from having more than one of them open at a time?
 
A

Andy

If you're just having different components on each tab, why do you need
MDI child forms at all? Just put the controls right on the tab page.

Andy
 
R

rhaazy

Well that is what I am already doing already. What I'm using the MDI
child forms for is say there is a button on every tabpage that will
result in a form being activated. i wanted to use MDI children so that
only one of these forms could be shown at a time. Is there another way
to prevent multiple forms from being open at the same time?
 
M

Marc Vangrieken

rhaazy said:
Well that is what I am already doing already. What I'm using the MDI
child forms for is say there is a button on every tabpage that will
result in a form being activated. i wanted to use MDI children so that
only one of these forms could be shown at a time. Is there another way
to prevent multiple forms from being open at the same time?

You could do the following in the code where you are creating an
instance of, lets say, Form2. Loop through the MdiChildren array, if
you find an instance of that type then do something with it, else
instantiate it.

foreach (Form frm in MdiChildren)
if (frm is Form2)
{
frm.BringToFront();
break;
}

I hope this help...
 
A

Andy

Take Marcs advice; using mdi children doesn't stop as many of any
particular kind of form from being displayed at all.
 
O

Otis Mukinfus

Well that is what I am already doing already. What I'm using the MDI
child forms for is say there is a button on every tabpage that will
result in a form being activated. i wanted to use MDI children so that
only one of these forms could be shown at a time. Is there another way
to prevent multiple forms from being open at the same time?

Look up ShowDialog in the help files. If you only want the user to be able to
access one form at a time, opening a form with ShowDialog opens it as a modal
form. When a user opens a modal form they cannot access any other form until
they close it.
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
R

rhaazy

MDI children forms can not cover controls of the parent form.
Unfortunately I merely have to change my methodology, getting rid of
parent child relations all together and using showdialog to call forms
that I dont' want the user to create more than one instance of.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top