View Single Post
Old 12-28-2012, 03:14 PM   PM User | #1
Sherby
New Coder

 
Join Date: Aug 2009
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Sherby is an unknown quantity at this point
Help with Assignment Please...

Graphical User Interface
Design for Windows Forms
OVERVIEW
You now have the basic GUI skill 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 or you won’t
receive full credit.
YOUR PROJECT
In the graded project for Lesson 3, you added grocery classes
to the GroceryApp project. In this project, you’ll add a form
to allow users to add grocery items to the shopping basket.
The form will also use menus. You’ll also set the startup form
and manage the login form window. The output of this project
will be used in the next graded project.
INSTRUCTIONS
1. In Visual Studio, load the GroceryApp project that you
completed in Lesson 3.
2. Add a new form to the project named GroceryItemForm.
3. Add controls to GroceryItemForm in the following layout:
Label controls, two TextBox controls, a NumericUpDown
control, a ComboBox control, a GroupBox component, a
RichTextBox control and a Button control.
4. Modify the design-time properties of the form and its
controls using the following table:
5. Add the option E&xit to the Application menu.
6. Add the options A&dd and &View in the Basket menu.
7. Save your work on GroceryItemForm.vb.
8. Open the design view of LoginForm.vb.
9. Select LoginForm. Set the AcceptButton and
CancelButton properties to the buttons btnLogin and
btnCancel, respectively.
10. Select txtPassword. Set the PasswordChar property to *.
11. Set the TabIndex property for the txtUsername and
txtPassword controls to 0 and 1, respectively.
12. Save these changes on LoginForm.vb.
13. Open the design view of GroceryItemForm.vb.
14. In the form’s Load event, display the login form modally.

I am a bit lost starting right here…..

15. In the Click event of the btnAddToBasket button, create
a GroceryItem object using the values from the controls
and add it to the basket variable. Remember the basket
variable is the GroceryBasket collection.
a. Make sure all controls except txtScanNumber contain
a value.
b. Set the value of the txtScanNumber control using the
following code:
txtScanNumber.Text = _
txtBrandName.Text.Substring(0, 3) & “1019”
c. Instantiate the GroceryItem class, using the control
values.
d. Use the following expression to set the Aisle property
[Enum].Parse(GetType(Aisle), lstAisle.Text)
This expression converts the text into an Aisle
enumeration.
e. Add the GroceryItem object to the basket variable.
f. Make sure to clear the content of all controls.
16. In the Click event of the Exit menu item, end the application.
17. Have the btnAddToBasket_Click method handle the
Click event of AddToolStripMenuItem as well.
18. 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. See Assignment 9 for help.
19. Set GroceryItemForm as the startup form.

Here is my code


Public Class GroceryItemForm

Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked

End Sub

Private Sub GroceryItemForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Create an instance of LoginForm.
Dim frmLogin As New LoginForm

' Display the login form in modal style.
frmLogin.ShowDialog()
End Sub

Private Sub btnAddToBasket_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddToBasket.Click,
AddToolStripMenuItem.Click

Dim objGroceryItem As New GroceryItemForm

objGroceryItem.lblBrandName.Text = "&Name"
objGroceryItem.lblScanNumber.Text = "&Scan"
objGroceryItem.lblPrice.Text = "&Price"
objGroceryItem.lblAisle.Text = "Bakery"
objGroceryItem.grpDescription.Text = "&Description"
objGroceryItem.btnAddToBasket.Text = "A&dd to Basket"
txtScanNumber.Text = _
txtBrandName.Text.Substring(0, 3) & 1019
objGroceryItem.lblAisle = [Enum].Parse(GetType(GroceryItem.AisleType), lstAisle.Text)




End Sub


Private Sub ViewToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ViewToolStripMenuItem.Click
MessageBox.Show("An item is successfully added")
End Sub

Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub



End Class
Sherby is offline   Reply With Quote