VB Forms, is MDI what I need?

Streen

Member
Joined
Apr 7, 2010
Messages
16
Programming Experience
3-5
I would like some advice on the use of VB Forms.

I have to write an application that consists of mainly one main form, but several different things I wanna display. Pretty standard I guess.
So there is a menu, some controls, and the main stuff below (ranging form graphs, tables, dropdown boxes, print preview, etc). I would like to use it like one would use frames in html, design an object that is limited to a box or panel that I define. The literature I have does not give me a clear idea of how to do this (yet).

The most obvious seem to be the use of MDI, open a predefined form with no borders, maximize it before showing and remove all minimize/maximize options. But that does not work so well. The form inside the MDI parent does not fit the size that is given for it when it is loaded.

e.g.
Dim ChildForm1 As New Tail.ChildForm1
ChildForm1.MdiParent = Me
ChildForm1.WindowState = FormWindowState.Maximized
ChildForm1.Show()

So my main question is: Is MDI the way to go here at all or are there better/easyer ways to achieve this?

If MDI is the way to go, how do I sucessfully restrict a child form inside another object, without giving the user any opportunity to resize (i noticed that I have minnimize/maximize/close buttons, even if I disable them on the child forms themselves)

I am new to VB (started last friday), but worked with a bunch of other environments, but unfortunately this one needs to be done in VB. Anyway, just point me in the right direction, I am not a complete noob.

Thanks
 
Well you've got a couple of things going on here, first off an MDI parent form usually only has a menu, toolbar(s) and a status bar and that's it, it's just a housing container for the child window(s) so to apply an entire form like a user control just conceptually shouldn't make sense.

This brings me to another point: user controls. You could design the user controls that you need to "fill the groupbox/panel" and simply swap out instances of the user controls on that area, just use the groupbox/panel as a container for the controls.

It's what you should be doing in this given scenario.
 
Thanks for the answer.

I am going with forms inside panels now. MDI was a stupid idea.

Is there actually an advantage to use controls inside panels as opposed to using forms inside panels?
 
A lot less overhead and/or confusion

Showing an entire form inside a panel isn't standard, I know with a lot of work it can be done, but I have never seen a situation where it's actually helpful (or even useful) so I'm having a hard time seeing where it'd be easier on you to do it that way.
 
For some reason, it was intuitive to me to use forms.
I have now looked further into usercontrols and I am already getting rid of most of my previous troubles.

Thanks for the advice, helped me greatly
 
Using a panel as a "form", can be quite effective. I'm using this now.

To avoid clutter in the designer, I am putting the panel's location to 1000,1000 and set it to 12,10 if I want to do something with the controls.

I then have a control object for each panel or screen which manages where the panel is located, sized. I'm using MVC to control which panel is visble.

Also you may find a tab control a fairly easy way to create multiple screens without using an MDI.
 
Back
Top