- Click File >> New Project. You might be asked to save changes to the current project if you’ve been experimenting. If so, click the No button. If you want to keep your work, click Yes. Select Standard EXE from the New Project Window.
2. Select the Form and change its property Name to frmFirst and Caption to First.
3. Double-Click the Command Button control in the toolbox to create a command button of default size in the center of the form. Drag the button near the bottom center of the form.
4. Select Command Button and change its Name property to cmdSecond and Caption to &Second Form.
5. Now Right-Click Project1 (Project1) from Project Window, select Add >> Form to add a New Form.
6. Select Form and click Open.
7. Select the Form and change its property Name to frmSecond and Caption to Second.
8. Double-Click the Command Button control in the toolbox to create a command button of default size in the center of the form. Drag the button near the bottom center of the form.
9. Select Command Button and change its Name property to cmdFirst and Caption to &First Form
10. Now double-click the cmdSecond button from frmFirst. Double-clicking a control (or a form) opens the Code window at the default event from the control. The default event for a command button is the Click event. This means that any code entered in the procedure will be executed when the user clicks the cmdFirst button.
Add the following lines of code between Private Sub and End Sub :
1: frmSecond.Show
2: Unload Me
11. The line of code frmSecond.Show tells the program to show frmSecond (Second Form we created earlier) and Unload Me tells the form to unload itself whenever the user clicks the cmdFirst button.
12. Double click frmSecond (frmSecond) from the Project Window. Double-click the cmdFirst button to open the code window.
Add the following lines of code between Private Sub and End Sub :
1: frmFirst.Show
2: Unload Me
13. The line of code frmFirst.Show tells the program to show frmFirst (First Form we created) and Unload Me tells the form to unload itself whenever the user clicks the cmdSecond button.
14 Save the project by pressing Ctrl + S from the keyboard or by clicking File >> Save and Run the program by pressing F5 from the keyboard. You should see a form, similar to the one in figure below.
15. Click button Second Form. This will show second form as shown in figure below and unload itself. Click button First Form to go back to First Form.
3 comments:
lala daami......... keep it up/////
this post was reali useful 4 d beginners lyk us...
Thank You and that i have a super offer you: What Renovations Can You Claim On Tax whole house renovation
Post a Comment