BlueOysterCult Posted February 9, 2004 Posted February 9, 2004 Hello all I think I am close to finishing this project but I am getting a "lare binding" error and can't seem to resolve it - HELP? Dim myCarList As Object Dim index As Integer Dim basicCarList As BasicVehicle Dim luxuryCarList As LuxuryVehicle index = cmbCarList.SelectedIndex myCarList = myCarList(index) If TypeOf (myCarList(index)) Is LuxuryVehicle Then luxuryCarList = CType(myCarList, LuxuryVehicle) txtYear.Text = CStr(luxuryCarList.Year) txtMake.Text = luxuryCarList.Make txtModel.Text = luxuryCarList.Model txtExtColor.Text = luxuryCarList.ExteriorColor txtIntColor.Text = luxuryCarList.InteriorColor 'txtSold.Text = CType(luxuryCarList.Sold, LuxuryVehicle) ElseIf (TypeOf (myCarList(index)) Is BasicVehicle) Then basicCarList = CType(myCarList, BasicVehicle) txtYear.Text = CStr(basicCarList.Year) txtMake.Text = basicCarList.Make txtModel.Text = basicCarList.Model txtExtColor.Text = basicCarList.ExteriorColor txtIntColor.Text = basicCarList.InteriorColor End If End Sub Rob Quote
Procaine Posted February 9, 2004 Posted February 9, 2004 There seems to be a confusion between collections of cars and individual cars. What does the MyCarLIst contain? Doing; myCarList = myCarList(index) This seems incorrect. I think you need a new variables here, something like: Dim selectedCar as object selectedCar = myCarList(index) ... I wouldn't recommend storing your cars stored in an object. Perhaps you could create a abstract base class for your cars, which basicCar and luxuryCar could inherit. This may make things a bit simpler. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.