Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents ButtonCalculate As System.Windows.Forms.Button
Friend WithEvents TextBoxPrincipalAmount As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents TextBoxNoOfMonths As System.Windows.Forms.TextBox
Friend WithEvents TextBoxInterestPerMonth As System.Windows.Forms.TextBox
Friend WithEvents TextBoxTotal As System.Windows.Forms.TextBox
Friend WithEvents ButtonClose As System.Windows.Forms.Button
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ButtonCalculate = New System.Windows.Forms.Button
Me.TextBoxPrincipalAmount = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.TextBoxNoOfMonths = New System.Windows.Forms.TextBox
Me.TextBoxInterestPerMonth = New System.Windows.Forms.TextBox
Me.TextBoxTotal = New System.Windows.Forms.TextBox
Me.ButtonClose = New System.Windows.Forms.Button
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.SuspendLayout()
'
'ButtonCalculate
'
Me.ButtonCalculate.Location = New System.Drawing.Point(142, 206)
Me.ButtonCalculate.Name = "ButtonCalculate"
Me.ButtonCalculate.Size = New System.Drawing.Size(64, 23)
Me.ButtonCalculate.TabIndex = 12
Me.ButtonCalculate.Text = "Calculate"
'
'TextBoxPrincipalAmount
'
Me.TextBoxPrincipalAmount.Location = New System.Drawing.Point(142, 38)
Me.TextBoxPrincipalAmount.Name = "TextBoxPrincipalAmount"
Me.TextBoxPrincipalAmount.Size = New System.Drawing.Size(120, 20)
Me.TextBoxPrincipalAmount.TabIndex = 10
Me.TextBoxPrincipalAmount.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(30, 38)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(96, 23)
Me.Label1.TabIndex = 6
Me.Label1.Text = "Principal Amount"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(30, 78)
Me.Label2.Name = "Label2"
Me.Label2.TabIndex = 3
Me.Label2.Text = "No of Months"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(30, 126)
Me.Label3.Name = "Label3"
Me.Label3.TabIndex = 4
Me.Label3.Text = "Interest / Month"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(30, 166)
Me.Label4.Name = "Label4"
Me.Label4.TabIndex = 5
Me.Label4.Text = "Total"
'
'TextBoxNoOfMonths
'
Me.TextBoxNoOfMonths.Location = New System.Drawing.Point(142, 78)
Me.TextBoxNoOfMonths.Name = "TextBoxNoOfMonths"
Me.TextBoxNoOfMonths.Size = New System.Drawing.Size(120, 20)
Me.TextBoxNoOfMonths.TabIndex = 9
Me.TextBoxNoOfMonths.Text = ""
'
'TextBoxInterestPerMonth
'
Me.TextBoxInterestPerMonth.Location = New System.Drawing.Point(142, 118)
Me.TextBoxInterestPerMonth.Name = "TextBoxInterestPerMonth"
Me.TextBoxInterestPerMonth.Size = New System.Drawing.Size(120, 20)
Me.TextBoxInterestPerMonth.TabIndex = 7
Me.TextBoxInterestPerMonth.Text = ""
'
'TextBoxTotal
'
Me.TextBoxTotal.Location = New System.Drawing.Point(142, 158)
Me.TextBoxTotal.Name = "TextBoxTotal"
Me.TextBoxTotal.Size = New System.Drawing.Size(120, 20)
Me.TextBoxTotal.TabIndex = 8
Me.TextBoxTotal.Text = ""
'
'ButtonClose
'
Me.ButtonClose.Location = New System.Drawing.Point(214, 206)
Me.ButtonClose.Name = "ButtonClose"
Me.ButtonClose.Size = New System.Drawing.Size(48, 23)
Me.ButtonClose.TabIndex = 11
Me.ButtonClose.Text = "Close"
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2})
Me.MenuItem1.Text = "Function"
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.Text = "Calculate"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.ButtonCalculate)
Me.Controls.Add(Me.TextBoxPrincipalAmount)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.TextBoxNoOfMonths)
Me.Controls.Add(Me.TextBoxInterestPerMonth)
Me.Controls.Add(Me.TextBoxTotal)
Me.Controls.Add(Me.ButtonClose)
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub ButtonCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCalculate.Click
Calculate()
End Sub
Private Sub Calculate()
Dim total As Double
total = (CType(TextBoxPrincipalAmount.Text, Double) + (CType(TextBoxNoOfMonths.Text, Double)) * (CType(TextBoxInterestPerMonth.Text, Double)))
TextBoxTotal.Text = CType(total, String)
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Calculate() 'calling the function Calculate()
End Sub
Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonClose.Click
Me.Close() 'closes the form
End Sub
End Class