omacron
Technical User
- Feb 5, 2002
- 149
I have a list(t) defined as;
Now I need to update the Total based on conditions of Type1 through Type4. The way I am currently doing this is with a for each loop;
This works fine but there has to be a better way to do this.
Thanks for your help
Code:
Public Class typeList
Private mType1 As String
Private mType2 As String
Private mType3 As String
Private mType4 As String
Private mTotal As Double
Public Property Total() As Double
Get
Return mTotal
End Get
Set(ByVal value As Double)
mTotal = value
End Set
End Property
Public Property Type4() As String
Get
Return mType4
End Get
Set(ByVal value As String)
mType4 = value
End Set
End Property
Public Property Type3() As String
Get
Return mType3
End Get
Set(ByVal value As String)
mType3 = value
End Set
End Property
Public Property Type2() As String
Get
Return mType2
End Get
Set(ByVal value As String)
mType2 = value
End Set
End Property
Public Property Type1() As String
Get
Return mType1
End Get
Set(ByVal value As String)
mType1 = value
End Set
End Property
Public Sub New()
End Sub
End Class
Code:
For Each ob In typeList
If iType1 = ob.Type1 And iType2 = ob.Type2 And iType3 = ob.Type3 And iType4 = ob.Type4 Then
ob.Total = iTotal
End If
Next
Thanks for your help