Visual Basic - Tony Gaddis Beginner VB.net student having trouble with the forms
ID: 3725390 • Letter: V
Question
Visual Basic - Tony Gaddis
Beginner VB.net student having trouble with the forms and calculations. If you have time I will appreciate any help. Struggling pretty bad.
Situation The Shopping Cart program is an adaptation of 2. Shopping Cart System on p. 488-490. You are to also include a ContextMenu on the main form. The Context Menu should include the options for Print Books and Audio Books. The program must also begin from a Standard Module and not a form. Specifications 1. Recurring Specifications that are required for all programs.
1. The form must be renamed and the text changed to Shopping Cart by Pedro Avila. (If Pat Programmer was creating this program, it would be Shopping Cart by Pat Programmer)
2. Code must be grouped and commented in compliance with this course's programming standards.
3. ALL files, forms, and controls MUST be renamed.
4. Option Strict and Option Explicit must be ON
5. An AcceptButton and a CancelButton must be assigned appropriately.
6. ALL controls on the form must be in logical TabOrder.
7. All buttons and labels (before TextBoxes) must have AccessKeys. 8. Form's StartPosition property must be CenterScreen.
9. Values from the input fields MUST be assigned to variables and the variables used in calculations.
10. The text property of Labels must be changed so that Label1 (or similar name) does not appear at runtime.
11. No class level variables unless specifically allowed.
12. Data types for variables and constants must be the most efficient.
13. Use With. End With if and when appropriate.
14. ToolTips
15. Use comments to explain your work.
2. Recreate the user interface shown above. For this program, your forms must replicate the examples 7- 65,66,67,68 from book
3. Constants are to be used for the book price values shown on p 488 and for the tax and shipping charge. Declare these in the Standard Module so that if they shop needed to change them in the future, they would all be in one location and easy to find.
4. The Start Up object (where the program begins) must be the Standard Module and not the main form.
5. Add menus as shown in the images above. At this point, only the main form is required to have a menu.
6. The Context Menu should be included with the Print Books and Audio Books options. Do not rewrite the code for these menu items: either call the Event Handlers or modify the Handles Clause.
7. The About menu will bring an About Box with the name of the program and the programmer's name
be removed from the screen and the tolal icgsut should the main form. TIP: Use a module with a global variable to hold the total cost. That way, both forms will have access to the variable. Shopping Cart System Design an application that works as a shopping cart system. The user should be able to add any of the following items to his or her shopping cart: Print Books (books on paper): 2. I Did It Your Way The History of Scotland Learn Calculus in One Day Feel the Stress $11.95 $14.50 $29.95 $18.50 Audio Books (books on tape): Learn Calculus in One Day The History of Scotland The Science of Body Language$12.95 Relaxation Techniques $29.95 $14.50 $11.50 The application's main form should appear similar to the one shown i n Figure 7-65. -65 Shopping Cart main formExplanation / Answer
I hope you have opened visual studio/basic in your system. So you first need to give the name of your project.
Let's choose the name ShopCart.
So we will divide our problem in parts by forms wise. Here we have three major forms.
1. Shopping Cart .
2. Print Books.
3. Audio Books.
Now we will move for form1(Shopping Cart). When you open the project in editor it comes up with a default form1. And on the right-up side, it have one Solution Explorer, and on right-low it have one properties box.
So as per our requirements of project we will change the name of default form1 to Shopping Cart in the 'text' section of properties. And we will change the binding to shopCart.
On the left hand side you must be able to see ToolBar. from there you need to select the 'menuscrip', and give the name 'File' and give the items Reset and Exit. In similar way you need to create the menu bar for 'Products' and 'Help'.
In solution explorer you need to create one extra form(infact two for print and audio books). Give it the name printForm and audioForm.
Now when you double click on Product->Print Books menu, it will bring you to backend code.
Will redirect to procedure of printBooks. there you need to add code:
printForm pF = new printForm();
pF.ShowDialog();
By this code it will redirect to form which will be maintained in point.2. There you can select and add item to MainForm Window.
We will maintain one global data, where it will save the array of structure, where book name(text) and value (int).
whenever we select the any book from (audio of print book) list, it update the array by just clicking on 'Add book to Cart' button. And will show the same in Text area of ShopCart and the respected value in SubTotal.
And tax and shipping.
Now we will move for 'Remove' procedure for removing item from cart.
Maintain ubound and lbound and update array len. and update same value to Subtotal/tax/shipping.
So conclusion for Form1 - Design Form and Write backend code.
In Design form you need to add menuscrip which we have already discussed. And needed to List and 5 Labels(Products Selected/SubTotal/Tax/Shipping/Total) , 4 TextBox(for SubTotal/Tax/Shipping/Total) and 1 Button (for Remove).
All tools will get binding name while adding.
All labels are as simple. and Text boxes would get altered as the new item selected (or updated in global array). Once the Remove clicked it would remove respected (for the list item selected) element and others recalculated.)
2. You need to maintain PrintForm and AudioForm. I will tell about one. In PrintForm similar to Form1, take Text for tool bar and give some binding name printBookList, and fill the text.
Insert two buttons from toolbar, And give name addPrintbook and closePrintBook, and update the text as expected in question.
By double clicking on button addPrintbook, move to backend code and Add it to global array with value and text.
And in close one write 'end' to close the form.
I hope you will write the similar code for AudioForm also.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.