Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class _Default
- Inherits System.Web.UI.Page
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- If Not IsPostBack Then
- End If
- End Sub
- Protected Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
- Dim loanAmount As Double
- Dim interestRate As Double
- Dim loanTerm As Double
- Try
- lblResult.ForeColor = Drawing.Color.Black ' reset the font color
- loanAmount = Convert.ToDouble(txtLoanAmount.Text)
- interestRate = Convert.ToDouble(txtInterestRate.Text) / 100 ' Convert to decimal
- loanTerm = Convert.ToDouble(txtLoanTerm.Text) * 12 ' Convert years to months
- Catch ex As Exception
- lblResult.ForeColor = Drawing.Color.Red
- lblResult.Text = "Invalid values were entered"
- Exit Sub
- End Try
- If loanAmount <= 0 OrElse loanTerm <= 0 Then
- lblResult.Text = "Please enter positive values for loan amount and term."
- lblResult.ForeColor = Drawing.Color.Red
- Exit Sub
- End If
- Dim monthlyInterestRate As Double = interestRate / 12
- lblResult.Text = "It was clicked"
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement