I tried to take a class on VB.net about a year about but do to issues I could not complete it. So I am trying to teach myself what I missed. I am trying to create a program for a deli. It will take delivery and carryout orders. On one form (Deli form) it will take the customer’s name and phone number. You can check if it is carryout or delivery then the menu is also displayed. I got the carryout and delivery and the customer names to work like I want and I can get it to register and add up the prices for the sandwiches (basic price nothing added) but I cannot figure out how to call on the ingredients. I am checklist box I can get the ingredients to perform like I want Example: when you hit the ham button the items shows up. And I can get the check mark to work as well (only have to click once not twice) but I cannot remember how to call the ingredients in the program. I know it has to do with an array (I understand the concept but mind is still blown in making it work.) I have reread the old school book, and like I said I understand the concept. I know the first item start with 0 but I cannot figure out how to program it. I have to see the picture in my head to understand things. The reason for this post is to get help with the Array. The program is nowhere near finished. I am hoping to have a total of 3 forms one will be the receipt with cashing out the customer, and what the person order is. The other form is for Managers use still working on the detail (sales for the day, how much lettuce was used) stuff like that. I have not read the chapter when I can call info from one form or another. That is why there is a submit button in the middle for testing purposes with what I have created so far. Any help with understanding arrays will be great. Also please let me know what you think about how I document the program so far is it easy to read and understand.
I have attached a screen shot of what the form looks like
'Deli register program
'Deli form
'Should decide if it is carry out or delivery.
'Take customer name and phone and address for delivery
'Act as a menu. Customer should be able to press the button for the sandwich and the ‘ingredients list should pop up and people can click on what they want. Same for the ‘sides and Drinks items.
'Cash out
'Opens a register form.
'Office
'Opens the office form.
'Clear
'Clear out the mistakes of either customer info wrong or wants to reorder.
'Register form
'These form should pull the customer’s info over tell you if it is a carry out or delivery.
'Should cash the person out then print a receipt with what Item that was orders and what ‘goes on the sandwiches includes the side items and drinks.
'Office form
'Totals all items from the day sells and tells how much ingredient where used for ‘inventory proposes (example sold 5 ham sandwiches with lettuce that is total of 1.25 ‘ounces of lettuce used).
'Menu items prices
'Ham sandwich total $3.00
'Turkey sandwich total $3.00
'Roast Beef sandwich total $3.00
'Club sandwich total $3.00
'Ingredents
'Works (everything) total .65
'Lettuce total .25
'Tomato total .15
'Mustard total Free
'Cheese totals .25
'Mayo total free
'Side Items
'Fruits total .90
'Cookies total .60
'Chips total .75
'Drinks
'Small total .85
'Medium total .90
'Large total $1.00
Public Class Deli
'Declaring all the sandwiches
Const Turkeysandwich As Decimal = 2.44D
Const Roastbeefsandwich As Decimal = 2.44D
Const Clubsandwich As Decimal = 2.44D
Const Hamsandwich As Decimal = 2.44D
'declaring the sandwiches as decimals for the register part
Dim hamtotaldecimal As Decimal
Dim turkeytotaldecimal As Decimal
Dim clubtotaldecimal As Decimal
Dim roasttotaldecimal As Decimal
'Not sure if I am going ot be using them
'How much the ingredients are
Const Works As Decimal = 0.65D
Const Lettuce As Decimal = 0.25D
Const Tomato As Decimal = 0.25D
Const Mustard As Decimal = 0D
Const Cheese As Decimal = 0.25D
Const Mayo As Decimal = 0D
Const Pickle As Decimal = 0.25D
'Not sure of which method to declare the ingredents
'Declaring all the ingrendents
Const Work_charged_decimal As Decimal = 0.65D
Const Lettuce_charged_decimal As Decimal = 0.25D
Const Tomato_charged_decimal As Decimal = 0.25D
Const Mustard_charged_decimal As Decimal = 0D
Const Cheese_charged_decimal As Decimal = 0.25D
Const Mayo_charged_decimal As Decimal = 0D
Const Pickle_charged_decimal As Decimal = 0.25D
'Declaring Side Items
Const Chips_charged_decimal As Decimal = 0.75D
Const Fruits_charged_decimal As Decimal = 0.9D
Const Cookies_charged_decimal As Decimal = 0.75D
'Declaring Drinks
Const Large_charged_decimal As Decimal = 1D
Const Medium_charged_decimal As Decimal = 0.9D
Const Small_charged_decimal As Decimal = 0.85D
'Declaring the sales and taxes
Dim taxdecimal As Decimal
Dim SubTotaldecimal As Decimal
Dim Totaldecimal As Decimal
Const salestax As Decimal = 0.0824D
Private Sub CarryCheck_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CarryCheck.CheckedChanged
'lets you pick and change if you want delivery or carryout
If CarryCheck.Checked = True Then
CarryGroup.Visible = True
Deliverygroup.Visible = False
End If
If CarryCheck.Checked = False Then
CarryGroup.Visible = False
Deliverygroup.Visible = False
End If
If CarryCheck.Checked = True Then
DeliveryCheck.Visible = False
End If
If CarryCheck.Checked = False Then
DeliveryCheck.Visible = True
End If
End Sub
Private Sub DeliveryCheck_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeliveryCheck.CheckedChanged
'lets you pick and change if you want delivery or carryout
If DeliveryCheck.Checked = True Then
Deliverygroup.Visible = True
CarryGroup.Visible = False
End If
If DeliveryCheck.Checked = False Then
Deliverygroup.Visible = False
CarryGroup.Visible = False
End If
If DeliveryCheck.Checked = True Then
CarryCheck.Visible = False
End If
If DeliveryCheck.Checked = False Then
CarryCheck.Visible = True
End If
End Sub
Private Sub HamButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HamButton.Click
'shows then ingredients when the button is pressed.
Ingredenth1.Visible = True
'sends the bare total for the sandwiches to the register form
If Ingredenth1.Visible = True Then
hamtotaldecimal = Hamsandwich
End If
If Ingredenth1.Visible = False Then
hamtotaldecimal = 0
End If
End Sub
Private Sub Turkeybutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Turkeybutton.Click
'shows then ingredients when the button is pressed.
Ingredent2.Visible = True
'sends the bare total for the sandwiches to the register form
If Ingredent2.Visible = True Then
turkeytotaldecimal = Turkeysandwich
End If
If Ingredent2.Visible = False Then
turkeytotaldecimal = 0
End If
End Sub
Private Sub Roastbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Roastbutton.Click
'shows then ingredients when the button is pressed.
Ingredent3.Visible = True
'sends the bare total for the sandwiches to the register form
If Ingredent3.Visible = True Then
roasttotaldecimal = Roastbeefsandwich
End If
If Ingredent3.Visible = False Then
roasttotaldecimal = 0
End If
End Sub
Private Sub Clubbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clubbutton.Click
'shows then ingredients when the button is pressed.
Ingredent4.Visible = True
'sends the bare total for the sandwiches to the register form
If Ingredent4.Visible = True Then
clubtotaldecimal = Clubsandwich
End If
If Ingredent4.Visible = False Then
clubtotaldecimal = 0
End If
End Sub
Private Sub Sidebutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sidebutton.Click
'shows then ingredients when the button is pressed.
Sidechecklist.Visible = True
End Sub
Private Sub Drinksbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Drinksbutton.Click
'shows then ingredients when the button is pressed.
Drinkchecklist.Visible = True
End Sub
Private Sub CustomerInfoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerInfoToolStripMenuItem.Click
'Clears only the customer info and reset the check boxes.
'Clears the checkboxes
DeliveryCheck.Checked = False
CarryCheck.Checked = False
'Customer info cleared out for the delivery and carryout
CarryFirstbox.Clear()
CarryPhonebox.Clear()
DelFirstbox.Clear()
DelAddressbox.Clear()
DelPhonebox.Clear()
Customerbox.Clear()
Addressdeliverybox.Clear()
Phonebox.Clear()
End Sub
Private Sub Submitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submitbutton.Click
'I cannot figure out how to call on the info on another form still learning for now to see what works sends info to the boxes at the bottom of the deli form
If CarryCheck.Checked = True Then
Customerbox.Text = CarryFirstbox.Text
End If
If DeliveryCheck.Checked = True Then
Customerbox.Text = DelFirstbox.Text
End If
If CarryCheck.Checked = True Then
Phonebox.Text = CarryPhonebox.Text
End If
If DeliveryCheck.Checked = True Then
Phonebox.Text = DelPhonebox.Text
End If
Addressdeliverybox.Text = DelAddressbox.Text
'need to learn how to reset a button if it was pressed but works first time around
SubTotaldecimal = (hamtotaldecimal + turkeytotaldecimal + clubtotaldecimal + roasttotaldecimal)
Subtotalbox.Text = SubTotaldecimal
End Sub
Private Sub MenuItemsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemsToolStripMenuItem.Click
'Reset menu Items
Subtotalbox.Clear()
Ingredenth1.Visible = False
Ingredent2.Visible = False
Ingredent3.Visible = False
Ingredent4.Visible = False
End Sub
End Class