home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH11 / 11-2-2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-20  |  2.7 KB  |  95 lines

  1. VERSION 5.00
  2. Begin VB.Form frmBenefits 
  3.    Caption         =   "Benefits Menu"
  4.    ClientHeight    =   2112
  5.    ClientLeft      =   1080
  6.    ClientTop       =   1488
  7.    ClientWidth     =   3108
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   7.8
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   2112
  20.    ScaleWidth      =   3108
  21.    Begin VB.CheckBox chkPlan 
  22.       Height          =   255
  23.       Index           =   3
  24.       Left            =   120
  25.       TabIndex        =   3
  26.       Top             =   1200
  27.       Width           =   3015
  28.    End
  29.    Begin VB.CheckBox chkPlan 
  30.       Height          =   255
  31.       Index           =   2
  32.       Left            =   120
  33.       TabIndex        =   2
  34.       Top             =   840
  35.       Width           =   3015
  36.    End
  37.    Begin VB.CheckBox chkPlan 
  38.       Height          =   255
  39.       Index           =   1
  40.       Left            =   120
  41.       TabIndex        =   1
  42.       Top             =   480
  43.       Width           =   3015
  44.    End
  45.    Begin VB.CheckBox chkPlan 
  46.       Height          =   255
  47.       Index           =   0
  48.       Left            =   120
  49.       TabIndex        =   0
  50.       Top             =   120
  51.       Width           =   3015
  52.    End
  53.    Begin VB.Label lblAmount 
  54.       Caption         =   "$0.00"
  55.       Height          =   255
  56.       Left            =   2280
  57.       TabIndex        =   5
  58.       Top             =   1680
  59.       Width           =   615
  60.    End
  61.    Begin VB.Label lblTotal 
  62.       Caption         =   "Total monthly payment:"
  63.       Height          =   255
  64.       Left            =   120
  65.       TabIndex        =   4
  66.       Top             =   1680
  67.       Width           =   2055
  68.    End
  69. Attribute VB_Name = "frmBenefits"
  70. Attribute VB_GlobalNameSpace = False
  71. Attribute VB_Creatable = False
  72. Attribute VB_PredeclaredId = True
  73. Attribute VB_Exposed = False
  74. Dim price(0 To 3) As Single 'In (Declarations) section of (General)
  75. Dim sum As Single
  76. Private Sub chkPlan_Click(Index As Integer)
  77.   If chkPlan(Index).Value = 1 Then
  78.       sum = sum + price(Index)
  79.     Else
  80.       sum = sum - price(Index)
  81.   End If
  82.   lblAmount.Caption = FormatCurrency(sum)
  83. End Sub
  84. Private Sub Form_Load()
  85.   Dim i As Integer, plan As String, cost As Single
  86.   Open App.Path & "\BENEFITS.TXT" For Input As #1
  87.   For i = 0 To 3
  88.     Input #1, plan, cost
  89.     price(i) = cost
  90.     chkPlan(i).Caption = plan & " (" & FormatCurrency(cost) & ")"
  91.   Next i
  92.   Close 1
  93.   sum = 0
  94. End Sub
  95.