Thursday 2 December 2021

Dec-2019(3) What is menu strip. Also explain the procedure to create menu strip.

Menu Bar/Strip – A menu bar is a thin, horizontal bar containing the labels of menus in a GUI. The menu bar provides the user with a place in a window to find the majority of a program's essential functions. These functions include opening and closing files, editing text, and quitting the program.

मेनू बार एक पतली, क्षैतिज पट्टी होती है जिसमें GUI में मेनू के लेबल होते हैं। मेनू बार उपयोगकर्ता को प्रोग्राम के अधिकांश आवश्यक कार्यों को खोजने के लिए विंडो में एक स्थान प्रदान करता है। इन कार्यों में फ़ाइलें खोलना और बंद करना, पाठ संपादित करना और प्रोग्राम को छोड़ना शामिल है।


The MenuStrip control works as the top-level container for the menu structure. The ToolStripMenuItem class and the ToolStripDropDownMenu class provide the functionalities to create menu items, sub menus and drop-down menus.

The following diagram shows adding a MenuStrip control on the form −

   

let us add menu and sub-menu items.


Take the following steps −
· Drag and drop or double click on a MenuStrip control, to add it to the form.
· Click the Type Here text to open a text box and enter the names of the menu items or sub-menu items you want. When you add a sub-menu, another text box with 'Type Here' text opens below it.
· Complete the menu structure shown in the diagram above.
· Add a sub menu Exit under the File menu.

· Double-Click the Exit menu created and add the following code to the Click event of 

ExitToolStripMenuItem −

Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) _

   Handles ExitToolStripMenuItem.Click

   End

End Sub



When the above code is executed and run using Start button available at the Microsoft Visual Studio tool bar, it will show the following window:

Click on the File -> Exit to exit from the application −



No comments:

Post a Comment