Initializes a new instance of the TBD class with a specified caption for the menu item.
[Visual Basic] Overloads Public Sub New( _ ByVal text As String _ ) [C#] public MenuItem( string text ); [C++] public: MenuItem( String* text ); [JScript] public function MenuItem( text : String );
When you specify a caption for your menu item with theparameter, you can also specify an accelerator key by placing an '&' before the character to be used as the accelerator key. For example, to specify the "F" in "File" as an accelerator key, you would specify the caption for the menu item as "&File".
The following example creates a TBD that specifies the caption of the menu item at the time it is constructed.
[Visual Basic]
Public Sub CreateMyMenus() ' Create an instance of a MenuItem with a specific caption. Dim MenuItem1 as MenuItem Set MenuItem1 = New MenuItem("&File") End Sub
MenuItem Class | MenuItem Members | System.WinForms Namespace | MenuItem Constructor Overload List