i really need a quick help with my code. when i debug the program no matter what the numbers in milage and Rate are the result is always 0 and here is my code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim Milage() As Double
Dim Dest As String = CStr(txtDestination.Text)
Dim Rate As Double
Dim Expense As Single
ReDim Milage(0 To 1000)
If IsNumeric(txtMilage.Text) = False Then
MessageBox.Show("Please enter a correct amount")
Exit Sub
End If
If IsNumeric(txtRate.Text) = False Then
MsgBox("Please Enter a Numeric Value for rate per mile")
Exit Sub
End If
If Milage(txtMilage.Text) >= 100 Then
Expense = Milage(txtMilage.Text) * Rate
txtAmount.Text = CStr(Expense)
Else : Expense = (Milage(txtMilage.Text) * Rate) / 2
txtAmount.Text = CStr(Expense)
End If
MessageBox.Show(Expense)
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
txtMilage.Text = ""
txtRate.Text = ""
txtAmount.Text = ""
txtDestination.Text = ""
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
Close()
End Sub
End Class