Where did I go wrong???
I have tried to find when my errror of "cannot convert type 'double' to systemevent.args! Can anyone show me the light??
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 Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents btncalculate As System.Windows.Forms.Button
Friend WithEvents txtMortgageAmount As System.Windows.Forms.TextBox
Friend WithEvents txtMortgageTerm As System.Windows.Forms.TextBox
Friend WithEvents txtInterestRate As System.Windows.Forms.TextBox
Friend WithEvents txtmortgagepayment As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.txtMortgageAmount = New System.Windows.Forms.TextBox
Me.txtMortgageTerm = New System.Windows.Forms.TextBox
Me.txtInterestRate = New System.Windows.Forms.TextBox
Me.txtmortgagepayment = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.btncalculate = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'txtMortgageAmount
'
Me.txtMortgageAmount.CausesValidation = False
Me.txtMortgageAmount.Location = New System.Drawing.Point(256, 56)
Me.txtMortgageAmount.MaxLength = 20
Me.txtMortgageAmount.Multiline = True
Me.txtMortgageAmount.Name = "txtMortgageAmount"
Me.txtMortgageAmount.Size = New System.Drawing.Size(208, 24)
Me.txtMortgageAmount.TabIndex = 2
Me.txtMortgageAmount.Text = "Amount"
'
'txtMortgageTerm
'
Me.txtMortgageTerm.Location = New System.Drawing.Point(256, 120)
Me.txtMortgageTerm.MaxLength = 4
Me.txtMortgageTerm.Name = "txtMortgageTerm"
Me.txtMortgageTerm.Size = New System.Drawing.Size(208, 20)
Me.txtMortgageTerm.TabIndex = 4
Me.txtMortgageTerm.Text = "Term"
'
'txtInterestRate
'
Me.txtInterestRate.Location = New System.Drawing.Point(256, 184)
Me.txtInterestRate.Name = "txtInterestRate"
Me.txtInterestRate.Size = New System.Drawing.Size(208, 20)
Me.txtInterestRate.TabIndex = 6
Me.txtInterestRate.Text = "Rate"
'
'txtmortgagepayment
'
Me.txtmortgagepayment.Location = New System.Drawing.Point(280, 304)
Me.txtmortgagepayment.Name = "txtmortgagepayment"
Me.txtmortgagepayment.Size = New System.Drawing.Size(152, 20)
Me.txtmortgagepayment.TabIndex = 8
Me.txtmortgagepayment.Text = "Result"
Me.txtmortgagepayment.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(32, 48)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(208, 40)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Enter Amount of Mortage"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.Label3.Location = New System.Drawing.Point(32, 112)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(208, 40)
Me.Label3.TabIndex = 3
Me.Label3.Text = "Enter Term of Mortage in Months"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label4
'
Me.Label4.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.Label4.Location = New System.Drawing.Point(32, 176)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(208, 40)
Me.Label4.TabIndex = 5
Me.Label4.Text = "Enter Intrest Rate as Whole Number"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'btncalculate
'
Me.btncalculate.Location = New System.Drawing.Point(256, 248)
Me.btncalculate.Name = "btncalculate"
Me.btncalculate.Size = New System.Drawing.Size(200, 23)
Me.btncalculate.TabIndex = 9
Me.btncalculate.Text = "Calculate!"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(744, 382)
Me.Controls.Add(Me.btncalculate)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.txtmortgagepayment)
Me.Controls.Add(Me.txtInterestRate)
Me.Controls.Add(Me.txtMortgageTerm)
Me.Controls.Add(Me.txtMortgageAmount)
Me.Name = "Form1"
Me.Text = "Mortage Calculator"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'This form will allow a user to calculate the mortage payment amount based upon user input.
'Created by Abdel Chehade II
'Release Version 1.03
'Revision date 9/24/04
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtmortgagepayment.TextChanged
'This calculates the mortgage
'Using the formula
'Principal*MonthInt/ (1-(1/(1+MonthInt))^(Years*12))
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMortgageAmount.TextChanged
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtInterestRate.TextChanged
End Sub
Private Sub btncalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalculate.Click
Dim Years As Double, Payment As Double
Dim MonthInt As Double, Amount As Double
Dim Percent As Double, Principal As Double
Dim Numerator As Double, Denominator As Double
'Get Info from user
Years = Val(txtMortgageTerm.Text)
Principal = Val(txtMortgageAmount.Text)
Percent = Val(txtInterestRate.Text) / 100
MonthInt = Percent / 12
Numerator = Principal * MonthInt
Denominator = 1 - (1 / (1 + MonthInt)) ^ (Years * 12)
Payment = Numerator / Denominator
txtmortgagepayment.Text = Str(Payment)
OnClick(Principal * MonthInt / (1 - (1 / (1 + MonthInt)) ^ (Years * 12)))
End Sub
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
End Sub
End Class
|