Menu Handling for Visual Basic 6.0 Users

The techniques for creating and working with menus in Visual Basic 2008 differ considerably from Visual Basic 6.0

Conceptual Differences

In Visual Basic 6.0, menus were created using the Menu Editor. Menus could not be created programmatically, but could be changed or added to programmatically.

In Visual Basic 2008, menus are created using a MenuStrip control, which provides a graphical menu designer. Menus can also be created programmatically.

Context Menus

In Visual Basic 6.0, context menus were created by calling the PopupMenu method of a form or control. Menus could not be created programmatically; the PopupMenu method required that a menu already existed.

In Visual Basic 2008, context menus are created using ContextMenuStrip controls, which provides a graphical menu designer; they can also be created programmatically by creating a new instance of the ContextMenuStrip class. For more information, see ContextMenuStrip Control Overview.

Merging Menus

In Visual Basic 6.0, the NegotiateMenus property of a form determined if a menu from an object on the form would be merged with the form's menu. This property could only be set at design time.

In Visual Basic 2008, menus can be merged using the AllowMerge property of a MenuStrip or ContextMenuStrip control.

Upgrade Notes

When a Visual Basic 6.0 application is upgraded to Visual Basic 2008, any existing menus are upgraded to MainMenu components. Menus that were used as context menus must be manually changed to use ContextMenuStrip controls.

See Also

Concepts

Menu Object for Visual Basic 6.0 Users

Windows Forms for Visual Basic 6.0 Users

Other Resources

MenuStrip Control (Windows Forms)