I have a tool that I developed in Excel using VB that I am trying to convert to a stand alone VB.NET program and I am having some tough sledding. In the equation (code is below) it is possible to have negative numbers. I currently have a userform with 3 masked (#.#) text boxes (dPP, dPC, dPA). A user might input the following scenario:
dPP = 5.0
dPC = 8.0
dPA = 2.0
If these were the inputs in the textboxes the equation should do the following:
8.0 > 5.0
dSP = 5.0 - 8.0
dPPR = -3.0 + 2.0
dPPR = -1.0
Unfortunately, when the equation is running I am getting a 2.0 so it looks as if it will not calculate negative numbers the way I currently have it written. I have tried Dimming as Integer and as Doubles but neither seems to have an effect. Thanks in advance for taking a look at this.
CODE
Private Sub cmdbDEAddDef_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdbDEAddDef.Click
Dim strNote As String
Dim strYNBx As String
Dim dPP, dPC, dPA As Double
Dim dSP As Double
Dim dPPR As Double
'Converts the Possible Point Total to Double
dPP = CDbl(txtDEPossPoints.Text.Trim)
dPC = CDbl(txtDEPointCited.Text.Trim) ‘Points Cited
dPA = CDbl(txtDETotalPtsApp.Text.Trim) ‘Total Points being appealed
If dPC > dPP Then
dSP = dPP - dPC
dPPR = (dSP + dPA)
Else
If dPC <= dPP Then dPPR = dPA
End If
This post has been edited by gram999: 5 Feb, 2008 - 01:23 PM