'create class
Public Class PayrollRecord Public Sub New() End Sub Private _inactiveFL As Boolean Private _amount As String Private _userID As String Private _empID As String Private _total As String Public Property InactiveFl() As Boolean Get Return _inactiveFL End Get Set(ByVal value As Boolean) _inactiveFL = value End Set End Property Public Property Amount() As String Get Return _amount End Get Set(ByVal value As String) _amount = value End Set End Property Public Property UserId() As String Get Return _userID End Get Set(ByVal value As String) _userID = value End Set End Property Public Property EmpId() As String Get Return _empID End Get Set(ByVal value As String) _empID = value End Set End Property Public Property Total() As String Get Return _total End Get Set(ByVal value As String) _total = value End Set End Property End Class
Imports System.Collections.Generic
'create generic collection Dim payroll As IList(Of PayrollRecord) = New List(Of PayrollRecord)
'Add records to payroll object. Dim pRoll As New PayrollRecord() pRoll.Amount = Amount pRoll.EmpId = EmpId pRoll.InactiveFl = InactiveFl pRoll.UserId = UserId pRoll.Total = Total payroll.Add(pRoll)
'loop thru each item in the payroll object For Each drow As PayrollRecord In payroll Write(CompId & "," & OrgId & "," & drow.EmpId.Trim & "," & drow.Amount & "," & drow.Total & "," & drow.UserId) Next