Gets or sets the text of the menu item.
[Visual Basic] Public Property Text As String [C#] public string Text {get; set;} [C++] public: __property String* get_Text(); public: __property void set_Text(String*); [JScript] public function get Text() : String; public function set Text(String);
The caption of the menu item.
When you specify a caption for your menu item with the Text property, 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 menu item, sets the caption, assigns a shortcut key, makes the menu item visible, and shows the shortcut key display for the menu item. The example assumes a MenuItem object has been created that is named MenuItem1.
[Visual Basic]
Public Sub SetupMyMenuItem() ' Set the caption for the menu item. MenuItem1.Text = "&New" ' Assign a shortcut key. MenuItem1.Shortcut = Shortcut.CtrlN ' Make the menu item visible. MenuItem1.Visible = True ' Display the shortcutkey combination. MenuItem1.ShowShortcut = True End Sub
MenuItem Class | MenuItem Members | System.WinForms Namespace