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 / CH5 / 5-2-3.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-18  |  2.1 KB  |  71 lines

  1. VERSION 5.00
  2. Begin VB.Form frmQuiz 
  3.    Caption         =   "A Quiz"
  4.    ClientHeight    =   2130
  5.    ClientLeft      =   1560
  6.    ClientTop       =   1755
  7.    ClientWidth     =   3570
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  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     =   2130
  20.    ScaleWidth      =   3570
  21.    Begin VB.PictureBox picSolution 
  22.       Height          =   375
  23.       Left            =   240
  24.       ScaleHeight     =   315
  25.       ScaleWidth      =   3075
  26.       TabIndex        =   3
  27.       Top             =   1560
  28.       Width           =   3135
  29.    End
  30.    Begin VB.CommandButton cmdEvaluate 
  31.       Caption         =   "Evaluate Answer"
  32.       Default         =   -1  'True
  33.       Height          =   495
  34.       Left            =   240
  35.       TabIndex        =   2
  36.       Top             =   840
  37.       Width           =   3135
  38.    End
  39.    Begin VB.TextBox txtAnswer 
  40.       Height          =   285
  41.       Left            =   2400
  42.       TabIndex        =   1
  43.       Top             =   360
  44.       Width           =   975
  45.    End
  46.    Begin VB.Label lblQuestion 
  47.       Caption         =   "How many gallons does a ten-gallon hat hold?"
  48.       Height          =   495
  49.       Left            =   240
  50.       TabIndex        =   0
  51.       Top             =   240
  52.       Width           =   2055
  53.    End
  54. Attribute VB_Name = "frmQuiz"
  55. Attribute VB_GlobalNameSpace = False
  56. Attribute VB_Creatable = False
  57. Attribute VB_PredeclaredId = True
  58. Attribute VB_Exposed = False
  59. Private Sub cmdEvaluate_Click()
  60.   Dim answer As Single
  61.   'Evaluate answer
  62.   picSolution.Cls
  63.   answer = Val(txtAnswer.Text)
  64.   If (answer >= 0.5) And (answer <= 1) Then
  65.       picSolution.Print "Good, ";
  66.     Else
  67.       picSolution.Print "No, ";
  68.   End If
  69.   picSolution.Print "it holds about 3/4 of a gallon."
  70. End Sub
  71.