Using ActionScript
Objectives:
- Make a dropdown menu in Visual Basic
- Add multiple forms to a project
|
Adding Multiple Forms
So far all your Visual Basic projects have only used one form per project. Today we will learn to add forms and then create a dropdown menu.
- Start a new project.
- Save Form1 as frmMasterTest.
- Change the form's caption property to read: Master Project.
- Change the form's name property to frmMasterProject.
- Save the project as Master Project Test.
- Find the add form button in the top left side of your window. It looks like this:
- Click on it and add a new form.
- Change the name property to frmFirst.
- Change the caption to say first.
- Save the form as frmFirst.
- Repeat the last four steps to create two additional forms, frmSecond and frmThird.
- Open up the Project Explorer window by clicking View > Project Explorer. It looks like this:
Adding a Menu
- We are going to add our menu to the form you saved named frmMasterTest. Select that form in your project explorer before you do the next step.
- Find the menu editor in the top left corner.
- Click on it. You will see this pop up:
- Type Projects in the caption box.
- Type mnuProjects in the name box.
- Click on the next button.
- Click on the right arrow button. You will see three dots appear.
- Type First in the captions box and mnuFirst in the name box. Click next.
- Repeat the last step and input menu items for Second and Third. When finished it will look like this:
- Select your master form and click on the word Projects. You should see the menu pop up.
Coding the Menu
Finally we come to the last step, writing code to make the menu work.
- Click on View > Code.
- Click the first drop down arrow and select mnuFirst.
- Type in your code to show the form as displayed above.
- Repeat the last two steps for your second and third forms.
- Now, the last step is to make sure than the master form is the form that starts off when it executes. Click on Project > Properties (the last item). Make sure that under the heading StartUp Object it reads: frmMasterProject. If it doesn't, change it. Note: You can control which form is the start up form through this menu item.
- Test out your project.
<< Back to Skyline |