⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aspmortgage.aspx.vb

📁 Programming Web and Desktop Applications in ADO .NET and ASP .NET
💻 VB
字号:
Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents lblTotalPayment As System.Web.UI.WebControls.Label
    Protected WithEvents lblYears As System.Web.UI.WebControls.Label
    Protected WithEvents txtInterestRate As System.Web.UI.WebControls.TextBox
    Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label
    Protected WithEvents Label4 As System.Web.UI.WebControls.Label
    Protected WithEvents txtPrincipal As System.Web.UI.WebControls.TextBox
    Protected WithEvents ddlYears As System.Web.UI.WebControls.DropDownList
    Protected WithEvents chkTotalPmt As System.Web.UI.WebControls.CheckBox
    Protected WithEvents lblMonthPayment As System.Web.UI.WebControls.Label
    Protected WithEvents btnCompute As System.Web.UI.WebControls.Button

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not Page.IsPostBack Then
            lblMonthPayment.Text = ""
            lblTotalPayment.Text = ""
            lblYears.Text = ""
        End If
    End Sub

    Private Sub ddlYears_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlYears.SelectedIndexChanged
        'Display Period Selected
        lblYears.Text = "Loan Duration " + ddlYears.SelectedItem.Text
    End Sub

    Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click

        'Compute Mortgage and Display Results
        Dim sngPrincipal, sngInterest, sngPayment As Single
        Dim intYears As Integer

        sngPrincipal = CSng(txtPrincipal.Text)
        sngInterest = CSng(txtInterestRate.Text) / 1200

        Select Case ddlYears.SelectedItem.Text
            Case "10 Years"
                intYears = 10
            Case "15 Years"
                intYears = 15
            Case "20 Years"
                intYears = 20
            Case "25 Years"
                intYears = 25
            Case "30 Years"
                intYears = 30
        End Select

        intYears = intYears * 12

        sngPayment = sngPrincipal * (sngInterest _
        / (1 - (1 + sngInterest) ^ -intYears))

        lblMonthPayment.Text = "Monthly Payments = " & _
        FormatCurrency(sngPayment)

        lblTotalPayment.Text = "Total Payments " & _
        FormatCurrency(sngPayment * intYears)

        'Display/Hide Total Payment
        lblTotalPayment.Visible = chkTotalPmt.Checked
    End Sub

    Private Sub chkTotalPmt_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkTotalPmt.CheckedChanged
        'Show/Hide Total Payment Result
        lblTotalPayment.Visible = chkTotalPmt.Checked
    End Sub


End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -