I'm trying to use a TryParse to convert a text value to an integer value. When I attempt to run a calculation, the variable that my calculation function recieves is always -1 regardless of the actual number being passed. I've run message boxes both before the calculation and during and receive two different numbers. The numbers before the calculation are correct.
This is an example of the calculation function:
Code:
Private Function SetTotal(ByVal pRanks As Integer, ByVal pMisc As Integer, ByVal pGroup As Integer)
Dim total As Integer
total = pRanks + pMisc + pGroup
Return total
End Function
The sub that is using the calculation looks like this:
Code:
Private Sub txtAppraiseRanks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAppraiseRanks.TextChanged
Integer.TryParse(txtAppraiseRanks.Text, zeroRank)
Integer.TryParse(txtAppraiseMisc.Text, zeroMisc)
txtAppraiseTotal.Text = SetSkillTotal(zeroRank, zeroMisc, groupMod).ToString
End Sub
I've tried placing the TryParse within the function call as well with the same results. The only variable that passes correctly is groupMod. That one is set in another section of the program.
Any suggestion or reasoning as to why this is happening?