Created this code however when I try to run it it crashes. I am very new to vb and have no idea how to fix the issue.
Public Class Form1
Dim years As Integer
Dim rate As Single
Dim currentYear As Long
Dim startingProfit As Single
Dim result As Integer
Dim result2 As Integer
Dim currentProfit As Integer
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
'Calculating the result of user input
years = 0
currentYear = Year(Date.Now)
startingProfit = 255000
currentProfit = startingProfit
Do While currentProfit <= 3000000
result = currentProfit / 100
result2 = result * rate
currentProfit = result2 + startingProfit
currentYear = currentYear + 1 'counter
Loop
lblResult.Text = "As at " & DateValue(Now) & "the profit margin in " & currentYear & "will be " & currentProfit & "."
End Sub
End Class
Public Class Form1
Dim years As Integer
Dim rate As Single
Dim currentYear As Long
Dim startingProfit As Single
Dim result As Integer
Dim result2 As Integer
Dim currentProfit As Integer
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
'Calculating the result of user input
years = 0
currentYear = Year(Date.Now)
startingProfit = 255000
currentProfit = startingProfit
Do While currentProfit <= 3000000
result = currentProfit / 100
result2 = result * rate
currentProfit = result2 + startingProfit
currentYear = currentYear + 1 'counter
Loop
lblResult.Text = "As at " & DateValue(Now) & "the profit margin in " & currentYear & "will be " & currentProfit & "."
End Sub
End Class