Sunday, January 10, 2010

MDI form Tutorial in VB

MDI form Tutorial in VB 6.0


MDI or Multiple Document Interface is the container form of child form. In visual basic MDI form has special meaning. This type of form is parent form of all other child forms. This form can not have normal VB controls like TextBox, Label etc. Instead you can add Menu, Status bar controls in MDI form. To add MDI form in Visual Basic go to Project -> Add MDI Form menu. This will add an MDI form. Only one MDI form can be added in a VB 6.0 project.

Normal Windows form is made an MDI child by setting its MDIChild property to True. When you make a form MDI child, its StartUpPosition can not be set to CenterScreen.

MDI forms supports some special properties, methods and events.

Arrange method: In windows application you might have noted a 'Window' menu with Arrange Icons, Cascade, Tile Horizontal and Tile Vertical sub menus. This will arragne the child windows accordingly. So you can call the arrange() method with the FormArrange Constants.

PrintForm, Pset and other normal form methods are not supported on MDI windows. Because no graphics drawing operation can be performed on the client area of the MDI window. You can only put a picturebox control inside the MDI form.

AutoShowChildren is specific property to MDI forms. This property Returns/sets a value (True/False) that determines whether MDI child forms are automatically displayed when loaded.

In short most application contain an MDI form that is place holder for other forms. With menu control on the top and status bar at the bottom.