I am a full time college student majoring in Computer Information Systems and Accounting. I need some help with this Visual Basic problem. I did not know where to post this but I saw student so I thought I could get some help. I only have until midnight for this one problem and it is bugging me. It really is quite discouraging. I'd email my teacher but he takes like 4 days to respond to his emails. Last time I emailed him, I got the "help" I needed 2 days after the assignment was due. I don't want to email my oher classmates because I do not want to feel like the "dumb one". I very rarely ask for help and I am due for some.
The objective is to modify a shipping hub to be able to run a LINQ on the package selected. I want to add all the information I find into a string called packageInfo. I also want to display that information in a message box using a message box show function.
This is my current code:
handles ListBox's DoubleClick event Private Sub packagesListBox_DoubleClick(sender As Object, e As System.EventArgs) Handles packagesListBox.DoubleClick Dim tempPackage As Package 'Step D Create a reference of package Dim packageInfo As String 'Step D Create a String to store the information about the given package Dim numberSelect As Integer ' Step e creating a integer that stores the number selected in the List Box numberSelect = packagesListBox.SelectedIndex ' Step e creating a integer that stores the number selected in the List Box ' Step e. Creating a LINQ query that selests from list the Package with the Packagenumber that's selected in ListBox Dim PackageNumberQuery = From p In list Where (p.PackageNumber = numberSelect) Select p ' Step f. If...Then statement to check if the number selected is a valid item. If packagesListBox.SelectedIndex = -1 Then MessageBox.Show("Please select a valid package number", _ "Important Message") End If ' Step g. Assign to tempPackage the first element of the query For Each tempPackage In list packageInfo = String.Concat(tempPackage) Next 'Step H Create an else statement to notify user if an invalid item has been selected from the ListBox If Not packagesListBox.SelectedIndex = -1 Then MessageBox.Show(packageInfo) Else MessageBox.Show("Error. Please select valid number") End If End Sub ' packagesListBox_DoubleClick
I'm pretty new at this whole visual basic thing and I don't know if it is the actual coding or the book that is confusing me. I have been working on this thing since Tuesday. (Already finished my other assignment and it's working perfectly). Am I missing a very simple issue?