Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.08 KB | None | 0 0
  1. Public Class Form1
  2.  
  3.     Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
  4.         DTEnd_CloseUp(sender, e)
  5.     End Sub
  6.  
  7.     Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
  8.         Me.Dispose()
  9.     End Sub
  10.     Private Sub tbPeriod_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbPeriod.Leave
  11.         DTEnd_CloseUp(sender, e)
  12.     End Sub
  13.  
  14.     Private Sub DTEnd_CloseUp(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DTEnd.CloseUp
  15.         Dim Principal As Double = "0123456789"
  16.         Dim InterestRate As Double = "0123456789"
  17.         Dim Periods As Double = "0123456789"
  18.         Dim InterestEarned As Double = "0123456789"
  19.         Dim FutureValue As Double = "0123456789"
  20.         Dim StartDate As DateTime
  21.         Dim EndDate As DateTime
  22.         Dim spnPeriod As TimeSpan
  23.         Dim Days As Integer = "0123456789"
  24.         Dim P As Double = 0.0
  25.  
  26.         Try
  27.             Principal = Double.Parse(tbPrincipal.Text)
  28.         Catch ex As Exception
  29.             MsgBox("Invalid Principal Value")
  30.         End Try
  31.  
  32.         Try
  33.             InterestRate = Double.Parse(tbInterest.Text) / 100
  34.         Catch ex As Exception
  35.             MsgBox("Invalid Interest Rate")
  36.         End Try
  37.  
  38.         StartDate = DTStart.Value
  39.         EndDate = DTEnd.Value
  40.  
  41.         If (EndDate < StartDate) Then
  42.             MsgBox("Invalid Date")
  43.             DTEnd.Value = DateTime.Today
  44.         End If
  45.         Return
  46.  
  47.         spnPeriod = EndDate.Subtract(StartDate)
  48.         Days = spnPeriod.Days
  49.         tbPeriod.Text = Days.ToString
  50.  
  51.         Try
  52.             P = Double.Parse(tbPeriod.Text)
  53.         Catch ex As Exception
  54.             MsgBox("Invalid Days")
  55.         End Try
  56.  
  57.         Periods = P / 365
  58.         InterestEarned = Principal * InterestRate * Periods
  59.         FutureValue = Principal + InterestEarned
  60.  
  61.         tbIntEarn.Text = InterestEarned.ToString("C")
  62.         tbFutVal.Text = FutureValue.ToString("C")
  63.  
  64.     End Sub
  65. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement