MDI with appearance of SDI

dean

Member
Joined
Jan 22, 2006
Messages
9
Programming Experience
3-5
I'm currently developing an application that will have a standard menubar,toolbar and statusbar, and will have varying content in the middle .

I'm currently using a main form setting it as mdicontainer and then using child forms to display the content in the middle.

I've set the child forms properties so that there's no close buttons etc. But I still get a menu item on the left hand of the menu, which provides access to close etc (but they are all greyed out).

  1. How do I get rid of this menu item ? (I still want proper menus to merge)
  2. Is an MDI approach the best way of doing this? (I don't need multiple forms open at once, but want a nice way of developing them separately from each other, not one big form)
Thanks for your time.

Dean.
 
MenuItem5.Visible = False

Highlight the menu item in question. Note it's name in the properties window, under design. Unless you changed it it should be like MenuItem5

In the program hide that item when desired by using:
MenuItem5.Visible = False

Unhide it by setting visible = true.


As for question 2:

I'm not a big fan of that method, but there are plenty of people who are. Depends on a lot of things. There are always several solutions when programming, some easier than others, some look better than others, some are more efficient, etc... I'm sure you'll get some opinions on this one. Personal preference will be the determining factor here.
 
It wasn't an actual menu item it was the control box, even though I'd turned it off. A bit more searching on the forum turned up the solution.

http://www.vbdotnetforums.com/showthread.php?t=4559

If WindowState is set to something other than Normal in properties, and having me.windowsstate=windowsstate.maximised and me.controlbox = False set on Form_Load, the form will still show the Control Box. Resetting the property to Normal, then having Me.WindowState = WindowState.Maximised on form load (with me.ControlBox = False), the control box doesn't show. -- V-B_New-B

Note, I also had to clear the ControlBox property.

dean.
 
Note that you can use usercontrols in lieu of forms, creating the usercontrols at run time as needed and adding/removing them to/from the main form.
 
Thanks for the suggestions,

Paszt are there any obvious advantages/disadvantages of using usercontrols?

Does anyone know of any good tutorials that cover 'complex' UI design under vb.net?


dean.
 
One advantage of using usercontrols I can think of is that you won't get the extra overhead of having a form. The disadvantage if you are using VB.NET 2003 is that you can't place MainMenu controls in usercontrols. In VB.NET 2005 there is the new MenuStrip control which can be placed in usercontrols.
 
Back
Top