ok heres my problem that Im working on I know its supposed to be parallel arrays. Im creating a directory that shows employees names in a list box on the main form. When the user selects a name from the list box, the only thing is the app has to display the employee ID number, dept name, and telepjhone number on another form. The app should store all employee ID numbers in seperate arrays.
VB.NET:
ok cool so how does this look so far [COLOR=black][FONT=inherit]
[COLOR=blue][FONT=inherit]Public[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Class[/FONT][/COLOR] frmEmployeeDirectory [COLOR=blue][FONT=inherit]Dim[/FONT][/COLOR] mstrEmployeeNames() [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] [COLOR=blue][FONT=inherit]String[/FONT][/COLOR] = {[COLOR=#A31515][FONT=inherit]"Anthony"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Billy"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Ashley"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"David"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Brittany"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Vanessa"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Craig"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Bria"[/FONT][/COLOR]} [COLOR=blue][FONT=inherit]Dim[/FONT][/COLOR] mintEmployeeID() [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Integer[/FONT][/COLOR] = {[COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2562"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2172"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2679"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2204"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2901"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2331"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2463"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"27072"[/FONT][/COLOR])} [COLOR=blue][FONT=inherit]Dim[/FONT][/COLOR] mstrDeparmentName() [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] [COLOR=blue][FONT=inherit]String[/FONT][/COLOR] = {[COLOR=#A31515][FONT=inherit]"Legal"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Engineering"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Accounting"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"R&D"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]" Manager"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Help Desk"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Programmer"[/FONT][/COLOR], [COLOR=#A31515][FONT=inherit]"Legal"[/FONT][/COLOR]} [COLOR=blue][FONT=inherit]Dim[/FONT][/COLOR] mintPhoneNumber() [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Integer[/FONT][/COLOR] = {[COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"773-651-9087"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"773-342-3997"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"312-892-5420"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"708-430-3877"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"773-543-7943"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"312-692-1288"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"2463"[/FONT][/COLOR]), [COLOR=blue][FONT=inherit]CInt[/FONT][/COLOR]([COLOR=#A31515][FONT=inherit]"708-389-9090"[/FONT][/COLOR])} [COLOR=blue][FONT=inherit]Private[/FONT][/COLOR] Names [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Integer[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Private[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Sub[/FONT][/COLOR] frmEmployeeDirectory_Load([COLOR=blue][FONT=inherit]ByVal[/FONT][/COLOR] sender [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] System.Object, [COLOR=blue][FONT=inherit]ByVal[/FONT][/COLOR] e [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] System.EventArgs) [COLOR=blue][FONT=inherit]Handles[/FONT][/COLOR] [COLOR=blue][FONT=inherit]MyBase[/FONT][/COLOR].Load [COLOR=blue][FONT=inherit]End[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Sub[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Private[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Sub[/FONT][/COLOR] lstEmployeeNames_SelectedIndexChanged([COLOR=blue][FONT=inherit]ByVal[/FONT][/COLOR] sender [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Object[/FONT][/COLOR], [COLOR=blue][FONT=inherit]ByVal[/FONT][/COLOR] e [COLOR=blue][FONT=inherit]As[/FONT][/COLOR] System.EventArgs) [COLOR=blue][FONT=inherit]Handles[/FONT][/COLOR] lstEmployeeNames.SelectedIndexChanged Names = [COLOR=blue][FONT=inherit]CType[/FONT][/COLOR](lstEmployeeNames.SelectedItem, Employees).Names [COLOR=blue][FONT=inherit]Me[/FONT][/COLOR].Text = Names.ToString [COLOR=blue][FONT=inherit]End[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Sub[/FONT][/COLOR][COLOR=blue][FONT=inherit]End[/FONT][/COLOR] [COLOR=blue][FONT=inherit]Class[/FONT][/COLOR][COLOR=green][FONT=inherit]'Private Sub btnChooseName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChooseName.Click[/FONT][/COLOR][COLOR=green][FONT=inherit]'user chooses name to get their employee ID, Dept Name and Phone number[/FONT][/COLOR][COLOR=green][FONT=inherit]'End Sub[/FONT][/COLOR][COLOR=green][FONT=inherit]'End Class[/FONT][/COLOR][/FONT][/COLOR]
Last edited: