Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
- DTEnd_CloseUp(sender, e)
- End Sub
- Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
- Me.Dispose()
- End Sub
- Private Sub tbPeriod_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbPeriod.Leave
- DTEnd_CloseUp(sender, e)
- End Sub
- Private Sub DTEnd_CloseUp(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DTEnd.CloseUp
- Dim Principal As Double = "0123456789"
- Dim InterestRate As Double = "0123456789"
- Dim Periods As Double = "0123456789"
- Dim InterestEarned As Double = "0123456789"
- Dim FutureValue As Double = "0123456789"
- Dim StartDate As DateTime
- Dim EndDate As DateTime
- Dim spnPeriod As TimeSpan
- Dim Days As Integer = "0123456789"
- Dim P As Double = 0.0
- Try
- Principal = Double.Parse(tbPrincipal.Text)
- Catch ex As Exception
- MsgBox("Invalid Principal Value")
- End Try
- Try
- InterestRate = Double.Parse(tbInterest.Text) / 100
- Catch ex As Exception
- MsgBox("Invalid Interest Rate")
- End Try
- StartDate = DTStart.Value
- EndDate = DTEnd.Value
- If (EndDate < StartDate) Then
- MsgBox("Invalid Date")
- DTEnd.Value = DateTime.Today
- End If
- Return
- spnPeriod = EndDate.Subtract(StartDate)
- Days = spnPeriod.Days
- tbPeriod.Text = Days.ToString
- Try
- P = Double.Parse(tbPeriod.Text)
- Catch ex As Exception
- MsgBox("Invalid Days")
- End Try
- Periods = P / 365
- InterestEarned = Principal * InterestRate * Periods
- FutureValue = Principal + InterestEarned
- tbIntEarn.Text = InterestEarned.ToString("C")
- tbFutVal.Text = FutureValue.ToString("C")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement