Hello,
So my question is that I have 2 list boxes in two forms aside from the main one. and I am trying to transfer what I choose in the side form to transfer to the list box.
several questions:
Why does the blank list form I have in the main form create a problem when I enter a name for the list box and why does it appear in the box when I put it there? As you can see in my errors. It doesn't seem to recognize the listbox that I wanted to leave empty in the main form.
Second question is how do I get names to add in the main form list box. I believe I have the right code but I seem to be missing something else as well. I want the names to display in the main list box and the integers to add up together so I can separately figure the tax and shipping myself. Thank you
Here are some pictures and codes
Main:
Print:
Audio:
Code:Public Class MainForm Dim frmAudioBooks As New AudioBooks Dim frmPrintedBooks As New PrintedBooks Const decTaxRate As Decimal = 0.06D ' Tax rate for Books Const decShipping As Decimal = 2D ' Shipping Rate per Book Const decPrintIDidIt As Decimal = 11.95D 'Price of Print Book "I Did It Your Way" Const decPrintHistory As Decimal = 14.5D 'Price of Print Book "The History of Scotland" Const decPrintCalculus As Decimal = 29.95D 'Price of Print Book "Learn Calculus in One Day" Const decPrintStress As Decimal = 18.5D 'Price of Print Book "Feel the Stress" Const decAudioCaluclus As Decimal = 29.95D 'Price of Audio Book "Learn Calculus in One Day" Const decAudioHistory As Decimal = 14.5D 'Price of Audio Book "The History of Scotland" Const decAudioScience As Decimal = 12.95D 'Price of Audio Book "The Science of Body Language" Const decAudioRelax As Decimal = 11.5D 'Price of Audio Book "Relaxation Techniques Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click 'Close the Form Me.Close() End Sub Private Sub mnuHelpAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelpAbout.Click 'Display a short description of the program MessageBox.Show("The program executes a shopping menu for the user to choose from many books both audio and printed and let's them pick from multiple books to check and buy. Designed by Justin Guan") End Sub Private Sub mnuProductsPrintedBooks_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuProductsPrintedBooks.Click frmPrintedBooks.Show() End Sub Private Sub mnuProductsAudioBooks_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuProductsAudioBooks.Click frmAudioBooks.Show() End Sub Private Sub mnuFileReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileReset.Click lstProducts.Items.Clear() End Sub End Class Public Class PrintedBooks Private Sub btnPrintAddCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintAddCart.Click Dim intPrintInput As Integer 'Holds the selected Printed Book For intPrintInput = 0 To lstPrint.Items.Count = -1 If lstPrint.SelectedIndex = -1 Then 'No book is selected MessageBox.Show("Select a book.") ElseIf lstPrint.GetSelected(intPrintInput) Then lstProducts.Items.Add(lstPrint.Items(intPrintInput)) 'Gets the Selected book End If Next End Sub End Class Public Class AudioBooks Private Sub btnAudioClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAudioClose.Click Me.Close() End Sub Private Sub btnAudioAddCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAudioAddCart.Click Dim intAudioInput As Integer 'Holds the selected Printed Book For intAudioInput = 0 To lstAudio.Items.Count = -1 If lstAudio.SelectedIndex = -1 Then 'No book is selected MessageBox.Show("Select a book.") ElseIf lstAudio.GetSelected(intAudioInput) Then lstProducts().Items.Add(lstAudio.Items(intAudioInput)) 'Gets the Selected book End If Next End Sub End Class







Reply With Quote