home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD14720292001.psc / frmMain.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  2001-02-09  |  14.7 KB  |  423 lines

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  4. Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
  5. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  6. Begin VB.Form frmMain 
  7.    Caption         =   "Mortgage Calculator"
  8.    ClientHeight    =   8595
  9.    ClientLeft      =   60
  10.    ClientTop       =   345
  11.    ClientWidth     =   11880
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   8595
  14.    ScaleWidth      =   11880
  15.    StartUpPosition =   2  'CenterScreen
  16.    WindowState     =   2  'Maximized
  17.    Begin VB.CommandButton cmdCopyChart 
  18.       Caption         =   "&Copy Chart"
  19.       Enabled         =   0   'False
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   9.75
  23.          Charset         =   0
  24.          Weight          =   700
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   495
  30.       Left            =   1320
  31.       TabIndex        =   13
  32.       Top             =   3600
  33.       Width           =   1215
  34.    End
  35.    Begin MSComDlg.CommonDialog cdlExport 
  36.       Left            =   3000
  37.       Top             =   2520
  38.       _ExtentX        =   847
  39.       _ExtentY        =   847
  40.       _Version        =   393216
  41.    End
  42.    Begin VB.CommandButton cmdToHTML 
  43.       Caption         =   "To &HTML"
  44.       Enabled         =   0   'False
  45.       BeginProperty Font 
  46.          Name            =   "MS Sans Serif"
  47.          Size            =   9.75
  48.          Charset         =   0
  49.          Weight          =   700
  50.          Underline       =   0   'False
  51.          Italic          =   0   'False
  52.          Strikethrough   =   0   'False
  53.       EndProperty
  54.       Height          =   495
  55.       Left            =   720
  56.       TabIndex        =   11
  57.       Top             =   3020
  58.       Width           =   1215
  59.    End
  60.    Begin VB.Frame Frame1 
  61.       Caption         =   "Graph"
  62.       BeginProperty Font 
  63.          Name            =   "MS Sans Serif"
  64.          Size            =   9.75
  65.          Charset         =   0
  66.          Weight          =   700
  67.          Underline       =   0   'False
  68.          Italic          =   0   'False
  69.          Strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   975
  72.       Left            =   2640
  73.       TabIndex        =   20
  74.       Top             =   3120
  75.       Visible         =   0   'False
  76.       Width           =   1455
  77.       Begin VB.OptionButton optGraph 
  78.          Caption         =   "Line"
  79.          BeginProperty Font 
  80.             Name            =   "MS Sans Serif"
  81.             Size            =   9.75
  82.             Charset         =   0
  83.             Weight          =   700
  84.             Underline       =   0   'False
  85.             Italic          =   0   'False
  86.             Strikethrough   =   0   'False
  87.          EndProperty
  88.          Height          =   255
  89.          Index           =   1
  90.          Left            =   120
  91.          TabIndex        =   15
  92.          Top             =   600
  93.          Width           =   1215
  94.       End
  95.       Begin VB.OptionButton optGraph 
  96.          Caption         =   "Area"
  97.          BeginProperty Font 
  98.             Name            =   "MS Sans Serif"
  99.             Size            =   9.75
  100.             Charset         =   0
  101.             Weight          =   700
  102.             Underline       =   0   'False
  103.             Italic          =   0   'False
  104.             Strikethrough   =   0   'False
  105.          EndProperty
  106.          Height          =   255
  107.          Index           =   0
  108.          Left            =   120
  109.          TabIndex        =   14
  110.          Top             =   300
  111.          Width           =   1215
  112.       End
  113.    End
  114.    Begin MSChart20Lib.MSChart MSChart1 
  115.       Height          =   3975
  116.       Left            =   4200
  117.       OleObjectBlob   =   "frmMain.frx":0000
  118.       TabIndex        =   19
  119.       Top             =   120
  120.       Visible         =   0   'False
  121.       Width           =   7575
  122.    End
  123.    Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
  124.       Height          =   3975
  125.       Left            =   120
  126.       TabIndex        =   18
  127.       Top             =   4200
  128.       Visible         =   0   'False
  129.       Width           =   11775
  130.       _ExtentX        =   20770
  131.       _ExtentY        =   7011
  132.       _Version        =   393216
  133.       Cols            =   8
  134.       FixedCols       =   0
  135.       AllowUserResizing=   1
  136.       FormatString    =   ""
  137.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  138.          Name            =   "MS Sans Serif"
  139.          Size            =   9.75
  140.          Charset         =   0
  141.          Weight          =   700
  142.          Underline       =   0   'False
  143.          Italic          =   0   'False
  144.          Strikethrough   =   0   'False
  145.       EndProperty
  146.    End
  147.    Begin VB.CommandButton cmdChart 
  148.       Caption         =   "&View Chart"
  149.       Enabled         =   0   'False
  150.       BeginProperty Font 
  151.          Name            =   "MS Sans Serif"
  152.          Size            =   9.75
  153.          Charset         =   0
  154.          Weight          =   700
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       Height          =   495
  160.       Left            =   120
  161.       TabIndex        =   12
  162.       Top             =   3600
  163.       Width           =   1215
  164.    End
  165.    Begin VB.CommandButton cmdAmortise 
  166.       Caption         =   "&Amortisation Table"
  167.       Enabled         =   0   'False
  168.       BeginProperty Font 
  169.          Name            =   "MS Sans Serif"
  170.          Size            =   9.75
  171.          Charset         =   0
  172.          Weight          =   700
  173.          Underline       =   0   'False
  174.          Italic          =   0   'False
  175.          Strikethrough   =   0   'False
  176.       EndProperty
  177.       Height          =   495
  178.       Left            =   120
  179.       TabIndex        =   10
  180.       Top             =   2520
  181.       Width           =   2415
  182.    End
  183.    Begin VB.TextBox txtResult 
  184.       Enabled         =   0   'False
  185.       BeginProperty Font 
  186.          Name            =   "MS Sans Serif"
  187.          Size            =   9.75
  188.          Charset         =   0
  189.          Weight          =   700
  190.          Underline       =   0   'False
  191.          Italic          =   0   'False
  192.          Strikethrough   =   0   'False
  193.       EndProperty
  194.       Height          =   375
  195.       Left            =   2880
  196.       TabIndex        =   16
  197.       Text            =   "0"
  198.       Top             =   1980
  199.       Width           =   1215
  200.    End
  201.    Begin VB.CommandButton cmdCalculate 
  202.       Caption         =   "&Monthly Payment"
  203.       BeginProperty Font 
  204.          Name            =   "MS Sans Serif"
  205.          Size            =   9.75
  206.          Charset         =   0
  207.          Weight          =   700
  208.          Underline       =   0   'False
  209.          Italic          =   0   'False
  210.          Strikethrough   =   0   'False
  211.       EndProperty
  212.       Height          =   495
  213.       Left            =   120
  214.       TabIndex        =   9
  215.       Top             =   1920
  216.       Width           =   2415
  217.    End
  218.    Begin MSComCtl2.DTPicker dtpStart 
  219.       Height          =   375
  220.       Left            =   2520
  221.       TabIndex        =   8
  222.       Top             =   1500
  223.       Width           =   1575
  224.       _ExtentX        =   2778
  225.       _ExtentY        =   661
  226.       _Version        =   393216
  227.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  228.          Name            =   "MS Sans Serif"
  229.          Size            =   9.75
  230.          Charset         =   0
  231.          Weight          =   700
  232.          Underline       =   0   'False
  233.          Italic          =   0   'False
  234.          Strikethrough   =   0   'False
  235.       EndProperty
  236.       CustomFormat    =   "dd/MM/yyy"
  237.       Format          =   24510467
  238.       CurrentDate     =   36908
  239.    End
  240.    Begin VB.TextBox txtTerm 
  241.       BeginProperty Font 
  242.          Name            =   "MS Sans Serif"
  243.          Size            =   9.75
  244.          Charset         =   0
  245.          Weight          =   700
  246.          Underline       =   0   'False
  247.          Italic          =   0   'False
  248.          Strikethrough   =   0   'False
  249.       EndProperty
  250.       Height          =   375
  251.       Left            =   2520
  252.       TabIndex        =   7
  253.       Top             =   1020
  254.       Width           =   735
  255.    End
  256.    Begin VB.TextBox txtInterest 
  257.       BeginProperty Font 
  258.          Name            =   "MS Sans Serif"
  259.          Size            =   9.75
  260.          Charset         =   0
  261.          Weight          =   700
  262.          Underline       =   0   'False
  263.          Italic          =   0   'False
  264.          Strikethrough   =   0   'False
  265.       EndProperty
  266.       Height          =   375
  267.       Left            =   2520
  268.       TabIndex        =   5
  269.       Top             =   540
  270.       Width           =   735
  271.    End
  272.    Begin VB.TextBox txtLoan 
  273.       BeginProperty Font 
  274.          Name            =   "MS Sans Serif"
  275.          Size            =   9.75
  276.          Charset         =   0
  277.          Weight          =   700
  278.          Underline       =   0   'False
  279.          Italic          =   0   'False
  280.          Strikethrough   =   0   'False
  281.       EndProperty
  282.       Height          =   375
  283.       Left            =   2520
  284.       TabIndex        =   4
  285.       Top             =   60
  286.       Width           =   1575
  287.    End
  288.    Begin VB.Label Label6 
  289.       AutoSize        =   -1  'True
  290.       Caption         =   "="
  291.       BeginProperty Font 
  292.          Name            =   "MS Sans Serif"
  293.          Size            =   9.75
  294.          Charset         =   0
  295.          Weight          =   700
  296.          Underline       =   0   'False
  297.          Italic          =   0   'False
  298.          Strikethrough   =   0   'False
  299.       EndProperty
  300.       Height          =   240
  301.       Left            =   2640
  302.       TabIndex        =   17
  303.       Top             =   2040
  304.       Width           =   135
  305.    End
  306.    Begin VB.Label Label5 
  307.       Caption         =   "%"
  308.       BeginProperty Font 
  309.          Name            =   "MS Sans Serif"
  310.          Size            =   9.75
  311.          Charset         =   0
  312.          Weight          =   700
  313.          Underline       =   0   'False
  314.          Italic          =   0   'False
  315.          Strikethrough   =   0   'False
  316.       EndProperty
  317.       Height          =   255
  318.       Left            =   3240
  319.       TabIndex        =   6
  320.       Top             =   600
  321.       Width           =   255
  322.    End
  323.    Begin VB.Label Label4 
  324.       Caption         =   "Date of First Payment:"
  325.       BeginProperty Font 
  326.          Name            =   "MS Sans Serif"
  327.          Size            =   9.75
  328.          Charset         =   0
  329.          Weight          =   700
  330.          Underline       =   0   'False
  331.          Italic          =   0   'False
  332.          Strikethrough   =   0   'False
  333.       EndProperty
  334.       Height          =   255
  335.       Left            =   120
  336.       TabIndex        =   3
  337.       Top             =   1560
  338.       Width           =   2295
  339.    End
  340.    Begin VB.Label Label3 
  341.       Caption         =   "Term (Whole Years):"
  342.       BeginProperty Font 
  343.          Name            =   "MS Sans Serif"
  344.          Size            =   9.75
  345.          Charset         =   0
  346.          Weight          =   700
  347.          Underline       =   0   'False
  348.          Italic          =   0   'False
  349.          Strikethrough   =   0   'False
  350.       EndProperty
  351.       Height          =   255
  352.       Left            =   120
  353.       TabIndex        =   2
  354.       Top             =   1080
  355.       Width           =   2295
  356.    End
  357.    Begin VB.Label Label2 
  358.       Caption         =   "Interest Rate:"
  359.       BeginProperty Font 
  360.          Name            =   "MS Sans Serif"
  361.          Size            =   9.75
  362.          Charset         =   0
  363.          Weight          =   700
  364.          Underline       =   0   'False
  365.          Italic          =   0   'False
  366.          Strikethrough   =   0   'False
  367.       EndProperty
  368.       Height          =   255
  369.       Left            =   120
  370.       TabIndex        =   1
  371.       Top             =   600
  372.       Width           =   2295
  373.    End
  374.    Begin VB.Label Label1 
  375.       Caption         =   "Loan Amount:"
  376.       BeginProperty Font 
  377.          Name            =   "MS Sans Serif"
  378.          Size            =   9.75
  379.          Charset         =   0
  380.          Weight          =   700
  381.          Underline       =   0   'False
  382.          Italic          =   0   'False
  383.          Strikethrough   =   0   'False
  384.       EndProperty
  385.       Height          =   255
  386.       Left            =   120
  387.       TabIndex        =   0
  388.       Top             =   120
  389.       Width           =   2295
  390.    End
  391. Attribute VB_Name = "frmMain"
  392. Attribute VB_GlobalNameSpace = False
  393. Attribute VB_Creatable = False
  394. Attribute VB_PredeclaredId = True
  395. Attribute VB_Exposed = False
  396. Private iPayments As Integer ' iPayments = no. of MONTHLY payments payable
  397. Private Sub cmdAmortise_Click()
  398. 'This sub populates the MSFlexgrid
  399.     On Error Resume Next ' to compensate for the error sometimes given in the cell colour changing routine
  400.     Dim sCurrMonth As String 'for the Date column
  401.     Dim iDay, iMonth, iYear, iCountPay As Integer ' 1st 3 are for the date column, 4th is the loop counter
  402.     Dim dCurrBal, dCurrInt, dCurrPrin, dEndBal, dCumInt, dTotPaid As Double 'Period's starting loan balance, interest this period,
  403.                                                                             'principal paid this period, loan balance at end of period,
  404.                                                                             'cumulative interest at end of period, total paid to date at end of period
  405.                                                                             '; respectively!
  406.     Dim sWhen As String 'the commencement date
  407.     frmMain.MousePointer = vbHourglass ' cpu busy
  408.     sWhen = dtpStart ' assign commencement date
  409.     iDay = Val(Left(sWhen, 2)) ' the day
  410.     iMonth = Val(Mid(sWhen, 4, 2)) ' the month
  411.     iYear = Val(Right(sWhen, 2)) ' the year - latter 2 are required to increment period
  412.     dTotPaid = txtResult.Text ' assign monthly payment
  413.     dCurrBal = txtLoan.Text ' assign loan balance for 1st period
  414.     dCurrInt = dCurrBal / 12 * (txtInterest / 100) ' assign interest for the first period
  415.     dCurrPrin = dTotPaid - dCurrInt ' assign principal paid for the first period
  416.     dEndBal = dCurrBal -= txtLoan.Te4rest9      eg loan ba e rst period
  417.     dCurrPrin = dTght         ' theXCurrPrin n 
  418.       Captnt date
  419.    . e r    Captnt date
  420.    .t Ra|tn  eguBal -=      saieg    
  421.       C1theXCheXCheXCheXbAt9    n = d5nterest / 100) ' assiguaox            3t    =   0   'Fa
  422.     dCur
  423.