Open Microsoft Visual Studio 2010.
- Click on File, then on New Project
- Select Visual Basic project and select Windows Form Application
- You’ll see a form appear.
Now, you will have to design the form.
- Select a richtextbox and draw one in the form. On the bottom right hand side of the VS 2010 window, there will be a properties window. In properties, go to multiline. It will be false. Set it to true. Now select a menustrip from the toolbox. Place it above the textbox. Change the anchor property to Top, Left, Right, Bottom.
- You will be given a field to write in. Write the name of a menu, say, File. Press enter. You will get another field. Continue entering menu Edit, Format, View and Help. To create a shortcut for a particular menu, go into the properties for that menu and find the shortcut property of that menu. After clicking on it, you will have various choices of shortcuts. To create an underline for a letter of a menu, like, to underline F of File, just insert & before the letter. For example, &File will underline F.
- Now, you will need to add various other controls from the toolbox. These are: openFileDialog, SaveFileDialog, PrintDialog, StatusStrip, FontDialog, ColorDialog, PageSetupDialog and help.
- You will find all these controls in the toolbox. Double click all of them, they will go the bottom of the form. This is so because they are invisible controls. They cannot be placed on your actual form. These boxes are useful when you want to do functions like saving a file or opening one or printing, as their names suggest.
- Now for the sub-menus. Click File. Under that, you will be given a field to type in. Type each sub-menu and press enter. To create a line separator, click the arrow on the right side of the field where you write the name of the sub-menu and click on separator.
- Open up notepad, and type in the sub-menus exactly as you see them and also add the same shortcuts. Under view, add an extra sub-menu, Colour.
- Under View, click the status bar sub-menu. Go to its properties and change the property “Check on Click” to true.
- With this, we finish designing our form. Now for the coding part.
Some important notes:-
- Give meaningful names to all the tools that you have used in your form.
- For example, give New a name, menuNew and so on.
- To include a status bar in your form, click on the small arrow on the right of the status strip field and select status bar. Give it a name SB.
- The name property will be the very first property in the properties tab.