Here is the code for both the shopping cart form and the printbooks form.
maybe this will help.
CODE
Private Sub frmCart_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub lstProducts_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub mnuFileReset_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileReset.Click
'Resets the form.
lstProducts.ClearSelected()
lblSubtotal.Text = ""
lblTax.Text = ""
lblShipping.Text = ""
lblTotalCost.Text = ""
lstProducts.Focus()
End Sub
Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
End
End Sub
Private Sub mnuHelpAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelpAbout.Click
MessageBox.Show("Shopping Cart Version 1.0")
End Sub
Private Sub mnuPrintBooks_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPrintBooks.Click
'Displays the print books window
Dim PrintBooks As New frmPrintBooks
PrintBooks.ShowDialog()
'Update the total cost
lblSubtotal.Text = FormatCurrency(g_subtotal)
lblTax.Text = FormatCurrency(g_tax)
lblShipping.Text = FormatCurrency(g_shipping)
lblTotalCost.Text = FormatCurrency(g_totalCost)
End Sub
Private Sub mnuAudioBooks_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAudioBooks.Click
'Displays the audio books widow
Dim AudioBooks As New frmAudioBooks
AudioBooks.ShowDialog()
'Update the total cost
lblSubtotal.Text = FormatCurrency(g_subtotal)
lblTax.Text = FormatCurrency(g_tax)
lblShipping.Text = FormatCurrency(g_shipping)
lblTotalCost.Text = FormatCurrency(g_totalCost)
End Sub
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
'Removes the selected item from the shopping cart list.
If lstProducts.SelectedIndex > -1 Then
If lstProducts.SelectedItem = "I Did It Your Way (Print)" Then
g_subtotal -= 11.95
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("I Did It Your Way (Print)")
ElseIf lstProducts.SelectedItem = "The History of Scotland (Print)" Then
g_subtotal -= 14.5
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("The History of Scotland (Print)")
ElseIf lstProducts.SelectedItem = "Learn Calculus in One Day (Print)" Then
g_subtotal -= 29.95
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("Learn Calculus in One Day (Print)")
ElseIf lstProducts.SelectedItem = "Feel the Stress (Print)" Then
g_subtotal -= 18.5
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("Feel the Stress (Print)")
ElseIf lstProducts.SelectedItem = "Learn Calculus in One Day (Audio)" Then
g_subtotal -= 11.95
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("Learn Calculus in One Day (Audio)")
ElseIf lstProducts.SelectedItem = "The History of Scotland (Audio)" Then
g_subtotal -= 14.5
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("The History of Scotland (Audio)")
ElseIf lstProducts.SelectedItem = "The Science of Body Language (Audio)" Then
g_subtotal -= 29.95
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("The Science of Body Language (Audio)")
ElseIf lstProducts.SelectedItem = "Relaxation Techniques (Audio)" Then
g_subtotal -= 18.5
g_tax = g_subtotal * 0.06
g_shipping -= 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
lstProducts.Items.Remove("Relaxation Techniques (Audio)")
End If
End If
End Sub
Private Sub txtSubtotal_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub lstProducts_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstProducts.SelectedIndexChanged
lstProducts.Items.Add(g_lstProducts)
End Sub
CODE
Private Sub btnPrintBooksCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintBooksCancel.Click
Me.Close()
End Sub
Private Sub btnPrintBooksAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintBooksAdd.Click
If lstPrintBooks.SelectedIndex > -1 Then
If lstPrintBooks.SelectedItem = "I Did It Your Way (Print)" Then
MessageBox.Show("I Did It Your Way (Print) has been" & vbCrLf & "added to your shopping cart.")
frmShoppingCart.lstProducts.Items.Add("I Did It Your Way (Print)")
g_subtotal += 11.95
g_tax = g_subtotal * 0.06
g_shipping += 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
ElseIf lstPrintBooks.SelectedItem = "The History of Scotland (Print)" Then
MessageBox.Show("The History of Scotland (Print) has been" & vbCrLf & "added to your shopping cart.")
g_subtotal += 14.5
g_tax = g_subtotal * 0.06
g_shipping += 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
ElseIf lstPrintBooks.SelectedItem = "Learn Calculus in One Day (Print)" Then
MessageBox.Show("Learn Calculus in One Day (Print) has been" & vbCrLf & "added to your shopping cart.")
g_subtotal += 29.95
g_tax = g_subtotal * 0.06
g_shipping += 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
ElseIf lstPrintBooks.SelectedItem = "Feel the Stress (Print)" Then
MessageBox.Show("Feel the Stress (Print) has been" & vbCrLf & "added to your shopping cart.")
g_subtotal += 18.5
g_tax = g_subtotal * 0.06
g_shipping += 2.0
g_totalCost = g_subtotal + g_tax + g_shipping
End If
End If
Me.Close()
End Sub