Penn Foster Graded Project 03783900 Visual Basic and the Visual Studio Environment
Now you’re ready to work on your first Visual Studio solution. This project will assess your understanding of Visual Basic and the Visual Studio Environment. Make sure that you follow all directions completely and verify your results before submitting the project. Remember to include all required components in your solution.
For your first project, you’ll create a login form using a Windows Forms Application project in Visual Studio. The login form will prompt the user for a username and password. This form is a high-fidelity prototype that will provide a default message if the user clicks the OK or Cancel buttons.
Note: The output of this project will be used in the graded project for Lesson 2.
1. In Visual Studio, create a new Windows Forms Application project named GroceryApp. Review the Try It Out exercises in Chapter 1 of your textbook if you need a reminder of how to perform this step.
2. Rename Form1.vb to LoginForm.vb. You can use either the Properties panel or right-click Form.vb in the Solution Explorer panel and choose the Rename option.
3. Add two Label, two TextBox, and two Button controls to Form1.
4. Modify the design-time properties of the form and its controls using the information in Table 1.
LoginForm Text Please Login
LoginForm Size 300,125
Label1 (Name) lblUsername
Label1 Text Username:
Label2 (Name) lblPassword
Label2 Text Password:
TextBox1 (Name) txtUsername
TextBox2 (Name) txtPassword
Button1 (Name) btnLogin
Button1 Text Login
Button2 (Name) btnCancel
Button2 Text Cancel
5. Move the controls to resemble the layout in Figure 16.
6. In the Click event handler for the btnLogin control, add the following statement:
MessageBox.Show(“Thank you for logging in, ” & txtUsername.Text , “Logged In. “)
7. In the Click event handler for the btnLogin control, add the statement Application.Exit() to close out of the application.
8. Save your work and debug the application.
9. Make sure the application works as intended.
To submit your project, you must provide the following two files:
To find these files, go to directory where you saved the GroceryApp project. To open the project directory, right-click on GroceryApp in the Solution Explorer panel and choose the Open Folder in File Explorer option in the context menu (Figure 17).
Copy both the LoginForm.vb and LoginForm.Designer.vb files to your Desktop or any other temporary location.
Your project will be graded using the following rubric:
All controls have correct properties set 70 points
The Login button displays the correct message box 10 points
The Cancel button closes out of the application 10 points
Both source code files are included 10 points
TOTAL 100 points