I have a form that contains textboxes and a few radio buttons and i want to pass the values of the controls to a method in my class CAirPort. It does this fine except I want the listbox on my frmMain to show the ID (which is a string) of the item added inside the box instead. Just not sure how to access variables of objects inside of the arraylist that my objects go into when created. Below is my code any help appreciated, just need to display the ID of the object in the listbox.
Code from CAirPort ClassCode:Public myAirPort As New CAirport Private Sub btnRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRecord.Click planeID = txtID.Text carrierName = cboxCarrier.Text Call myAirPort.Arrival(fuelCharge, planeDeparture, planeArrival, carrierName, planeType, planeID) frmMain.lstAirplanes.Items.Add(myAirPort) MessageBox.Show("Arrival Recorded") Me.Close() End Sub
Code:Private mAirplanes As New ArrayList() Public Sub Arrival(ByVal planeFuelCharge As Decimal, ByVal planeDeparture As Date, ByVal planeArrival As Date, ByVal planeCarrierName As String, _ ByVal planeType As typeAirPlane, ByVal planeID As String) mAirplanes.Add(New CAirplane(planeFuelCharge, planeDeparture, planeArrival, planeCarrierName, planeType, planeID)) End Sub




Reply With Quote