Hi, I'm having problems trying to figure out how to divide the value in a text box.
One textbox is named Purchase Price
I want to take that number and get it divided by 5. That answer will be the down payment.
I declared a const for downpayment for 5.
I did the ToDouble for the purchase price as well for downpayment. I'll put what I have down so far for the coding. I'm just having trouble finding my error.
Imports System.Convert
Public Class Form1
Private Const DOWN_PAYMENT As Double = 5
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtPurchasePrice.Text = ""
txtInterestRate.Text = ""
txtDownPayment.Text = ""
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim PurchasePrice As Double
Dim InterestRate As Double
Dim DownPayment As Double
PurchasePrice = ToDouble(txtPurchasePrice.Text)
InterestRate = ToDouble(txtInterestRate.Text) / 100
DownPayment = ToDouble(txtDownPayment.Text)
DownPayment = txtPurchasePrice.Text / 5
DownPayment = System.Math.Abs(DownPayment)
End Sub
End Class
If anyone could help me out please.