Get Guided Penn Foster 037096
Get Guided Penn Foster 037096
File, Printing, and
Database Access in
Windows Forms
OVERVIEW
YOUR PROJECT
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
control DataGridView.
You’ll add a form to the project to display grocery items in
the basket.
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.
INSTRUCTIONS
1. In Visual Studio, load the GroceryApp project that you
completed in Lesson 4.
2. Add the options &Save and &Load to the Application
menu.
197
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,
300.
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
DataGridView control:
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.
SUBMISSION GUIDELINES
To submit your project, you should build the project and
submit the following file:
GroceryApp.exe
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
Courses page.
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
submissions.)
5. If you wish to include comments about this project to
your instructor, enter your comments in the Message
box.
6. Click on Submit Files.
GRADING CRITERIA
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
200
Want Help with Penn Foster?
We understand the dire situation of students. If you are wondering, can I pay someone to do my exam, then we have got you covered. Time is of the essence, and students can’t take any risks when it comes to exams. To help our students in these circumstances, we have updated our operations from an hourly basis to 24/7, addressing students’ pay someone to take my exam now concerns. Our experts work round the clock on your order. Moreover, our customer representatives are always online to take in your hire someone to take my exam queries. Get online classes, exams, and course assistance from Get Exam Done. For custom, help email us at [email protected] or WhatsApp us at +1(657)366-7486