Results 1 to 3 of 3

Thread: [2005] Question on adding to listbox from an object

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    97

    [2005] Question on adding to listbox from an object

    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:
     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 from CAirPort Class
    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
    Last edited by Planet_x; Apr 12th, 2008 at 11:47 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width