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 / CH7 / 7-3-1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  4.2 KB  |  147 lines

  1. VERSION 5.00
  2. Begin VB.Form frm7_3_1 
  3.    ClientHeight    =   2985
  4.    ClientLeft      =   1095
  5.    ClientTop       =   1485
  6.    ClientWidth     =   2910
  7.    BeginProperty Font 
  8.       Name            =   "MS Sans Serif"
  9.       Size            =   8.25
  10.       Charset         =   0
  11.       Weight          =   700
  12.       Underline       =   0   'False
  13.       Italic          =   0   'False
  14.       Strikethrough   =   0   'False
  15.    EndProperty
  16.    LinkTopic       =   "Form1"
  17.    PaletteMode     =   1  'UseZOrder
  18.    ScaleHeight     =   2985
  19.    ScaleWidth      =   2910
  20.    Begin VB.PictureBox picTotal 
  21.       Height          =   375
  22.       Left            =   120
  23.       ScaleHeight     =   315
  24.       ScaleWidth      =   2595
  25.       TabIndex        =   11
  26.       Top             =   2520
  27.       Width           =   2655
  28.    End
  29.    Begin VB.CommandButton cmdCompute 
  30.       Caption         =   "Compute Total Sales"
  31.       Height          =   495
  32.       Left            =   480
  33.       TabIndex        =   10
  34.       Top             =   1920
  35.       Width           =   1935
  36.    End
  37.    Begin VB.TextBox txtSales 
  38.       Height          =   285
  39.       Index           =   4
  40.       Left            =   1800
  41.       TabIndex        =   9
  42.       Top             =   1560
  43.       Width           =   975
  44.    End
  45.    Begin VB.TextBox txtSales 
  46.       Height          =   285
  47.       Index           =   3
  48.       Left            =   1800
  49.       TabIndex        =   8
  50.       Top             =   1200
  51.       Width           =   975
  52.    End
  53.    Begin VB.TextBox txtSales 
  54.       Height          =   285
  55.       Index           =   2
  56.       Left            =   1800
  57.       TabIndex        =   7
  58.       Top             =   840
  59.       Width           =   975
  60.    End
  61.    Begin VB.TextBox txtSales 
  62.       Height          =   285
  63.       Index           =   1
  64.       Left            =   1800
  65.       TabIndex        =   6
  66.       Top             =   480
  67.       Width           =   975
  68.    End
  69.    Begin VB.TextBox txtSales 
  70.       Height          =   285
  71.       Index           =   0
  72.       Left            =   1800
  73.       TabIndex        =   5
  74.       Top             =   120
  75.       Width           =   975
  76.    End
  77.    Begin VB.Label lblDepart 
  78.       Alignment       =   1  'Right Justify
  79.       Caption         =   "Label1"
  80.       Height          =   255
  81.       Index           =   4
  82.       Left            =   120
  83.       TabIndex        =   4
  84.       Top             =   1560
  85.       Width           =   1455
  86.    End
  87.    Begin VB.Label lblDepart 
  88.       Alignment       =   1  'Right Justify
  89.       Caption         =   "Label1"
  90.       Height          =   255
  91.       Index           =   3
  92.       Left            =   120
  93.       TabIndex        =   3
  94.       Top             =   1200
  95.       Width           =   1455
  96.    End
  97.    Begin VB.Label lblDepart 
  98.       Alignment       =   1  'Right Justify
  99.       Caption         =   "Label1"
  100.       Height          =   255
  101.       Index           =   2
  102.       Left            =   120
  103.       TabIndex        =   2
  104.       Top             =   840
  105.       Width           =   1455
  106.    End
  107.    Begin VB.Label lblDepart 
  108.       Alignment       =   1  'Right Justify
  109.       Caption         =   "Label1"
  110.       Height          =   255
  111.       Index           =   1
  112.       Left            =   120
  113.       TabIndex        =   1
  114.       Top             =   480
  115.       Width           =   1455
  116.    End
  117.    Begin VB.Label lblDepart 
  118.       Alignment       =   1  'Right Justify
  119.       Caption         =   "Label1"
  120.       Height          =   255
  121.       Index           =   0
  122.       Left            =   120
  123.       TabIndex        =   0
  124.       Top             =   120
  125.       Width           =   1455
  126.    End
  127. Attribute VB_Name = "frm7_3_1"
  128. Attribute VB_GlobalNameSpace = False
  129. Attribute VB_Creatable = False
  130. Attribute VB_PredeclaredId = True
  131. Attribute VB_Exposed = False
  132. Private Sub Form_Load()
  133.   Dim depNum As Integer
  134.   For depNum = 0 To 4
  135.     lblDepart(depNum).Caption = "Department" & Str(depNum + 1)
  136.   Next depNum
  137. End Sub
  138. Private Sub cmdCompute_Click()
  139.   Dim depNum As Integer, sales As Single
  140.   sales = 0
  141.   For depNum = 0 To 4
  142.     sales = sales + Val(txtSales(depNum).Text)
  143.   Next depNum
  144.   picTotal.Cls
  145.   picTotal.Print "Total sales were " & FormatCurrency(sales)
  146. End Sub
  147.