Buy Best Penn Foster 037843
File, Printing, and
Database Access in
In the graded project for Lesson 4, you added the
GroceryItemForm to the GroceryApp project. In this project,
you’ll add functionality to save and load saved grocery basket
files. You’ll display the contents of the basket using the data-bound
You’ll add a form to the project to display grocery items in
This will be the last graded project based on this scenario.
You’ll be graded on the end-user functionality, so variable
names and other aspects can differ, but the application must
work as intended.
1. In Visual Studio, load the GroceryApp project that you
completed in Lesson 4.
2. Add the options &Save and &Load to the Application
3. Add the OpenFileDialog and SaveFileDialog components
to the Windows form. Name them open dialog and
save dialog, respectively.
4. 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. See Chapter 9 in your book for details on how
to format the text file.
5. 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. See the
MSDN Library Web page http://msdn.microsoft.com/
en-us/library/b873y76a.aspx for more information.
6. Save your work and test the program. Add some items to
the basket and save them. Then attempt to load them
again. Click on the View option in the Basket menu to
see the basket contents. You’ll modify how this menu
option works in the concluding steps.
7. Add a new form to the project named
BasketDisplayForm. Set the Text property to Basket
Contents. You should also set the Size property to 600,
8. Add a DataGridView control named view basket. Set the
Dock property to Fill.
9. In the Load event of the BasketDisplayForm, add the
following code to display the basket contents in the
viewBasket.DataSource = basket
Notice how simple it’s to perform data-binding with data
sources other than databases.
10. Go back to the code view of GroceryItemForm and
replace the content of the ViewToolStripMenuItem_Click
event handler. Load and display the BasketDisplayForm
modally instead. Remember you don’t have to worry
about the basket variable, because the BasketDisplayForm
handles data-binding in its Load event.
11. Save and run the application. Verify that all controls and
menus work correctly. You’ll submit the compiled application
for this project.
Note: If you close the Login form, you don’t need to perform
the login process. This is by design so that you can
test the application without logging on.
To submit your project, you should build the project and
submit the following file:
To find this file, you should go to the directory where you saved
the GroceryApp project. To determine this path, click on
GroceryApp in the Solution Explorer panel. Copy the
value for the Project Folder property in the Properties
panel. In Windows Explorer, paste the file path and hit the
Enter key. Then, go to the bin debug folder. Copy the
GroceryApp.exe file to your desktop or any other temporary
location. This EXE file is the compiled application and you
can double-click on it to run it without using Visual Studio.
Use the following procedure to submit your project online:
1. Log in to view your student homepage and go to the My
2. Click on Take Exam next to the lesson you’re working on.
3. Attach your files as follows:
a. Click on the Browse box.
b. Locate the file you wish to attach.
c. Double-click on the file.
d. Click Upload File.
e. If you have more than one file to attach, repeat
steps a–d for each file.
4. Enter your e-mail address in the box provided.
(Note: Your e-mail address is required for online
5. If you wish to include comments about this project to
your instructor, enter your comments in the Message
6. Click on Submit Files.
Remember to follow directions and follow good programming
principles as described in the study guide.
Your project will be graded using the following rubric:
■ The Save menu option performs
the correct behavior. 130 points
■ The Load menu option performs
the correct behavior. 130 points
■ The View menu option performs
the correct behavior. 115 points
■ The BasketDisplayForm is
laid out correctly. 115 points
■ The compiled application is
included and runs. 110 points
TOTAL 100 points
Need Help with Penn Foster?
If you are searching out instant exam help to reduce stress, your take-a-study solutions are most effective a click away. Professional mentoring can Assignment enables you to greed your weakest trouble and obtains unheard-of results. We have trouble-matter, online check helpers at IWantOnlineclasshelp.com who understand all the essential components that will help you get the best scores. We pay hobby whilst you ask us for live exam assistance. All you need is to rent our online exam help. Our online exam tutors will create a question paper based mostly on your path material. You will gather every solution you request for.