hitechboy78737
Programmer
I have an array list that exists in a class that I add to using the .add method.
ex.
.bonusColl.Add(objBonus)
I know that the objBonus is a valid object containing data.
When this line goes to retrieve the public property bonusColl, I get the "Object Reference" error.
I'm kinda lost here... it works fine in another class, and I can't seem to find what's different...
Here's some code:
which calls add2BonusCollection
All the lines work except for .bonusColl.Add(objBonus) The public property looks like this:
Again, I know that the objBonus has data, the objBonusCollection is good... its just when I get the public property bonusColl from the objBonusCollection that I get this error.
If I need to include some more of the code- please tell me.. I guessed what would be useful
Thanks for your help... I'm really symied on this one but it will turn out to be something really simple I bet!
Kevin Howell
Briefcase of Talent- Austin, Tx
ex.
.bonusColl.Add(objBonus)
I know that the objBonus is a valid object containing data.
When this line goes to retrieve the public property bonusColl, I get the "Object Reference" error.
I'm kinda lost here... it works fine in another class, and I can't seem to find what's different...
Here's some code:
Code:
Public Function getBonusCollFromTerms(ByVal termID As Long) As cls_BonusCollection
Dim objConn As New OleDbConnection(getDSN())
Dim strSQL As String = "SELECT fldBonID, fldTermID, fldBonAmt, fldBonCap, fldBonText, fldBonRcv FROM tblBonuses WHERE fldTermID= " & termID & " ORDER BY fldBonCap;"
Dim ds As DataSet = getDataSet(objConn, strSQL, "tblBonuses", "text")
Dim dt As DataTable = ds.Tables("tblBonuses")
Dim rowCount As Integer = dt.Rows.Count
Dim dr As DataRow
Dim x As Integer = 0
Try
Dim objBonusCollection As New cls_BonusCollection
objBonusCollection.clearBonusCollection()
If rowCount > 0 Then
Do While x < rowCount
dr = dt.Rows(x)
Dim objBonus As New cls_Bonus
With objBonus
.dataRow2objBonus(dr, objBonus)
add2BonusCollection(objBonusCollection, objBonus)
End With
x = x + 1
Loop
End If
Return objBonusCollection
Catch ex As Exception
showError(ex)
Finally
objConn.Close()
ds.Dispose()
dt.Dispose()
End Try
End Function
which calls add2BonusCollection
Code:
Public Sub add2BonusCollection(ByRef objBonusCollection As cls_BonusCollection, ByVal objBonus As cls_Bonus)
Try
With objBonusCollection
'set collection variables
.bonusCollTermID = objBonus.bonusTermID
'calculate gross
.calcBonusCollGross(objBonusCollection, objBonus, "+")
'add bonus to collection
.bonusColl.Add(objBonus)
'update count
.bonusCollCount = .bonusColl.Count
End With
Catch ex As Exception
showError(ex)
End Try
End Sub
All the lines work except for .bonusColl.Add(objBonus) The public property looks like this:
Code:
Public Property bonusColl() As ArrayList
Get
Return _bonusColl
End Get
Set(ByVal Value As ArrayList)
_bonusColl = Value
End Set
End Property
Again, I know that the objBonus has data, the objBonusCollection is good... its just when I get the public property bonusColl from the objBonusCollection that I get this error.
If I need to include some more of the code- please tell me.. I guessed what would be useful
Thanks for your help... I'm really symied on this one but it will turn out to be something really simple I bet!
Kevin Howell
Briefcase of Talent- Austin, Tx