sliderslider
New member
- Joined
- Nov 13, 2013
- Messages
- 1
- Programming Experience
- Beginner
Dim preyearA As Double Dim curryearA As Double Dim MBB As Integer Dim DGB As Integer Dim success As Boolean Success = Double.TryParse(txtPreYearMainBase.Text, Globalization.NumberStyles.Currency, CInfo, prevmainbase) Success = Double.TryParse(txtCurrYearMainBase.Text, Globalization.NumberStyles.Currency, CInfo, currmainbase) Success = Integer.TryParse(txtMBB.Text, MBB) Success = Integer.TryParse(txtDollarGrowthB.Text, DGB) If CInt(txtCurrYearMainBase.Text) > 0 Then Sum = (currmainbase - prevmainbase) If Sum >= 0.0 AndAlso Sum <= 99998.0 Then Sum = 0 'Add some number of points. ElseIf Sum >= 99999.0 AndAlso Sum <= 149998.0 Then Sum = 2 'Add some other number of points ElseIf Sum >= 149999.0 AndAlso Sum <= 199998.0 Then Sum = 4 'Add some other number of points ElseIf Sum >= 199999.0 AndAlso Sum <= 249998.0 Then Sum = 6 'Add some other number of points ElseIf Sum >= 249999.0 AndAlso Sum <= 299998.0 Then Sum = 8 'Add some other number of points ElseIf Sum >= 299999.0 AndAlso Sum <= 10000000.0 Then Sum = 10.0 'Add some other number of points txtDollarGrowthB.text = Sum.ToString End If End If If CInt(txtCurrYearMainBase.Text) > 0 Then Sum = ((currmainbase - prevmainbase) / (prevmainbase)) If Sum >= 0.0 AndAlso Sum <= 0.178 Then Sum = 0 'Add some number of points. ElseIf Sum >= 0.179 AndAlso Sum <= 0.188 Then Sum = 3 'Add some other number of points ElseIf Sum >= 0.189 AndAlso Sum <= 0.198 Then Sum = 4 'Add some other number of points ElseIf Sum >= 0.199 AndAlso Sum <= 0.208 Then Sum = 5 'Add some other number of points ElseIf Sum >= 0.209 AndAlso Sum <= 0.218 Then Sum = 6 'Add some other number of points ElseIf Sum >= 0.219 AndAlso Sum <= 0.228 Then Sum = 7 'Add some other number of points ElseIf Sum >= 0.229 AndAlso Sum <= 0.238 Then Sum = 8 'Add some other number of points ElseIf Sum >= 0.239 AndAlso Sum <= 0.248 Then Sum = 9 'Add some other number of points ElseIf Sum >= 0.249 AndAlso Sum <= 1.0 Then Sum = 10 'Add some other number of points txtMBB.Text = Sum.ToString End If End If
Basically I have another IF Then Ladder that is very similar to the examples above that works great. I just can't seem to figure out what has gone wrong with this piece of code as its more intuitive and should be easier. If I remove the Ladder (on the subtraction equation) and generate the answer it works but doesn't seem to go through the ladder.
As a note the numbers going into all the textboxes will be whole numbers.
And another note this is a clip from the code.
Thanks for your time
Last edited by a moderator: