Penn Foster Graded Project 03784200 Graphical User Interface Design for Windows Forms
You now have the basic GUI skills to make the GroceryApp project a multiple-form application. This project will assess your understanding of using controls, menus, and handling multiple forms. 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.
In the graded project for Lesson 3, you added grocery classes to the GroceryApp project. In this project, you’ll add a form with controls and menus to allow users to add grocery items to the shopping basket. You’ll also set the startup form and manage the login form.
Note: You’ll use the output of this project in the graded project for Lesson 5.
1. In Visual Studio, load the GroceryApp project that you completed in Lesson 3. If this is not available, then you will need to ask your instructor for the finished Lesson 3 project.
2. Add a new form to the project named GroceryItemForm.
3. Add controls to GroceryItemForm to the layout shown
This form contains two menus, four Label controls, two TextBox controls, a NumericUpDown control, a ComboBox control, a GroupBox component, a RichTextBox control, and a Button control.
Note: See Assignment 10 in Lesson 4 for how to lay out controls.
1. Modify the design-time properties of the form and its controls using the information in Table 3.
2. Add the option E&xit to the Application menu.
3. Add the options A&dd and &View in the Basket menu.
4. Save your work on GroceryItemForm.vb.
5. Open the design view of LoginForm.vb.
6. Set the AcceptButton and CancelButton properties on LoginForm to the buttons btnLogin and btnCancel, respectively.
7. Set the PasswordChar property to * on txtPassword.
8. Set the TabIndex property for the two TextBox controls to 0 and 1, respectively.
9. In the Click event of btnCancel button, end the application.
10. Save these changes on LoginForm.vb.
11. Open GroceryItemForm.vb.
12. In the form’s Load event, display the login form modally and exit the application.
13. In the Click event of the btnAddToBasket button, perform the following steps:
a. Create a GroceryItem object using the values from the controls and add it to the basket variable.
Note: Remember the basket variable is the GroceryBasket collection.
b. Verify all controls except txtScanNumber contain a value.
c. Set the value of the txtScanNumber control using the following code:
t xt ScanNum ber. Text = _txtBrandName.Text.Substring(0,3) & “1019”
d. Instantiate the GroceryItem class, using the control values.
e. Use the following expression to set the Aisle property. The expression converts the text into an Aisle enumeration.
[Enum].Parse(Get Type(Aisle), cboAisle.Text )
f. Add the GroceryItem object to the basket variable.
14. In the Click event of the Exit menu item, end the application.
15. Have the btnAddToBasket_Click method handle the Click event of AddToolStripMenuItem as well.
16. In the Click event of the View menu item, display all of the items in the basket variable in an informational message box. You need only display the Aisle, ScanNumber and BrandName properties.
17. Set GroceryItemForm as the startup form.
18. Save and run the application. Verify that all controls and menus work correctly.
Note: You don’t need to login successfully to test the application. If you click the Close button in the top right corner of the login form, you can skip the login process. This is by design in this case, but in a real-world application, this would be considered a serious security breach.
19. Test your work.
To submit your project, you must provide the following files:
PREPARE YOUR 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 45.
Copy the LoginForm.Designer.vb, GroceryItemForm.vb and GroceryItemForm.Designer.vb files to your desktop or any other temporary location.
Your project will be graded using the following rubric:
The GroceryItemForm contains the required controls and layout 40 points
The GroceryItemForm contains the required application logic 20 points
The LoginForm has been modified correctly 10 points
All source code files are included 30 points
TOTAL 100 points