Gets or sets the menu item's position in its parent menu.
[Visual Basic] Public Property Index As Integer [C#] public int Index {get; set;} [C++] public: __property int get_Index(); public: __property void set_Index(int); [JScript] public function get Index() : int; public function set Index(int);
The zero-based position of the menu item in its parent menu.
This property provides the indexed position of a menu item in its parent menu's array of menu items. You can use this property to reposition a menu item to a different location within its menu.
The following example switches the position of two menu items in a menu. The following example assumes that two menu items are created called MenuItem1 and MenuItem2. MenuItem1 will move down one position in the menu, while MenuItem2 moves up one position.
[Visual Basic]
Public Sub SwitchMyMenuItems() ' Move MenuItem1 down one position in the menu order. MenuItem1.Index = MenuItem1.Index + 1 ' Move MenuItem2 up one position in the menu order. MenuItem2.Index = MenuItem2.Index - 1 End Sub
MenuItem Class | MenuItem Members | System.WinForms Namespace