I am using the following code to load an ArrayList with an object.
It works great~! However,HTML Code:Do While Not EOF(jjFileNumber) Dim omdObj As New OMD Dim omdText As String = LineInput(jjFileNumber) Dim omdValue() As String = Split(omdText, ",") Dim value As String = String.Empty 'Serial number is in b (index 1) value = omdValue(1) omdObj.SerialNumber = value 'EQ ID is in column C or index 2 omdObj.EquipID = omdValue(2) 'Maint Type is in Column D or index 3 omdObj.MaintType = omdValue(3) 'System Model is in Column E or index 4 omdObj.sysModel = omdValue(4) 'System Serial is in Column F or index 5 omdObj.sysSerial = omdValue(5) 'Customer ShipTo is in column I or index 8 omdObj.custShipToAcct = omdValue(8) 'customer name is in column J or index 9 omdObj.CustomerName = omdValue(9) OMDlist.Add(omdObj) Loop FileClose(jjFileNumber) End If
I don't know how to retrieve the object from the ArrayList using the Item property.
I am using the following withOUT Success. The code is searching the arraylist for a match on serial number. Values(2) is correct and is working fine - the problem is purely getting the object information from the arraylist.
the object has the following property structure:Code:For ctr = 0 To OMDlist.Count - 1 If Values(2) = OMDList.Item(ctr) Then ps.AssetNbr = OMDlist.Item(ctr) End If Next
How do I pull the propertys back from the object in the arraylist to compare the values with Values(2)?Code:Public Class OMD Private strSN As String Private strEQID As String Private strCustName As String Private strCustAcct As String Private strSysMod As String Private strSysSerial As String Private strMaintType As String Property SerialNumber() As String Get Return strSN End Get Set(ByVal Value As String) strSN = Value End Set End Property Property EquipID() As String Get Return strEQID End Get Set(ByVal Value As String) strEQID = Value End Set End Property Property CustomerName() As String Get Return strCustName End Get Set(ByVal Value As String) strCustName = Value End Set End Property Property custShipToAcct() As String Get Return strCustAcct End Get Set(ByVal Value As String) strCustAcct = Value End Set End Property Property MaintType() As String Get Return strMaintType End Get Set(ByVal Value As String) strMaintType = Value End Set End Property Property sysModel() As String Get Return strSysMod End Get Set(ByVal Value As String) strSysMod = Value End Set End Property Property sysSerial() As String Get Return strSysSerial End Get Set(ByVal Value As String) strSysSerial = Value End Set End Property End Class
Thank you in advance for any help you can provide. It is greatly appreciate.


Reply With Quote
