WINDOWS FORMS AND APPLICATIONS
This project will assess your understanding of accessing files, using data-bound controls, and deploying your application. Make sure that you follow all directions completely and verify your results before submitting the project. Remember to include all required com¬ponents in your solution.
In the graded project for Lesson 4, you added the GroceryItemForm to the GroceryApp project. In this project, you’ll do the following:
Q QAdd functionality to save and load saved grocery basket files.
Q QDisplay the contents of the basket using the data-bound control DataGridView.
Q QAdd a form to the project to display grocery items in the basket.
Q QLocate and share your application assembly with your instructor.
This project is the last graded project based on this scenario. You’ll be graded on the end-user functionality, so variable names and other code conventions are your choice, but the application must behave as expected.
1. In Visual Studio, load the GroceryApp project that you completed in Lesson 4.
2. Open the GroceryItemForm.vb file.
3. Add the options &Save and &Load to the Application menu above the Exit option. (You can add the Save and Exit options to the Application menu underneath Exit and then click and drag them above it.)
4. Add the OpenFileDialog and SaveFileDialog components to the Windows form.
5. In the Click event for the Save option, prompt the user for a file location and store the basket as a text file. Recall that grocery items are stored in the basket variable.
Hint: You could use a CSV file similar to a flat-file database, like the example in Lesson 5.
6. In the Click event for the Load option, prompt the user for a file location and load the contents of the text file into the basket. Make sure you empty the basket first.
Hint: You could use the Split method in the String class to break each line into individual array items.
7. Save your work and test the application.
a. Add some items to the basket and save them.
b. Attempt to load them again.
c. Click the View option in the Basket menu to see the basket contents. You’ll modify how this menu option works in the concluding steps.
8. Add a new form to the project, named BasketDisplayForm.
a. Set the Text property to Basket Contents.
b. Set the Size property to 600, 300
9. Add a DataGridView control named viewBasket.
10. Set the Dock property of the DataGridView control to Fill.
11. In the Load event of the BasketDisplayForm, add the following code to display the basket contents in the DataGridView control:
view Basket.DataSource 5 basket
Notice how simple it is to perform data-binding with collections.
12. Go back to the code view of GroceryItemForm.
13. Replace the content of the ViewToolStripMenuItem_Click event handler, so that it loads and displays the BasketDisplayForm modally.
Hint: You don’t have to worry about the basket variable, because the BasketDisplayForm handles data-binding in its Load event.
14. Save and run the application. Verify that all controls and menus work correctly. You’ll submit the compiled application for this project.
Your project will be graded using the following rubric:
Exemplary (4) Proficient (3) Fair (2) Poor (1) Not Evident (0)
The Save menu option performs the correct behavior. N/A N/A N/A The Save menu option doesn’t work.
The Load menu option performs the correct behavior. N/A N/A N/A The Load menu option doesn’t work.
The View menu option performs the correct behavior. N/A N/A N/A The View menu option doesn’t work.
The BasketDisplayForm is laid out cor¬rectly. The BasketDisplayForm is mostly laid out correctly. The BasketDisplayForm is laid out correctly. The BasketDisplayForm is laid out poorly. There’s no evi-dence of the BasketDisplayForm.
The compiled appli¬cation is included and runs. N/A N/A N/A There’s no evidence of a running complied application.
Submitting Your Project
You’ll submit the GroceryApp.exe file for your project. To find this file, you should go to the directory where you saved the GroceryApp project. To open the project directory, right-click GroceryApp in the Solution Explorer panel and choose the Open Folder in File Explorer option in the context menu. Go to the bin\Debugfolder and copy the GroceryApp.exe file to your desktop or any other temporary location. You should make sure the GroceryApp.exe file executes before submission. You can double-click it with¬out using Visual Studio for testing.
Each project is individually graded by your instructor and therefore takes up to a few weeks to grade.
To submit your graded project, follow these steps:
1. Go to http://www.pennfoster.edu.
2. Log in to your student portal.
3. Click Take Exam next to the lesson you’re working on.
4. Follow the instructions provided to complete your exam.
Be sure to keep a backup copy of any files you submit to the school!
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.