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 / CH9 / 9-1-4.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-18  |  3.6 KB  |  120 lines

  1. VERSION 5.00
  2. Begin VB.Form frm9_1_4 
  3.    Caption         =   "Colleges"
  4.    ClientHeight    =   1935
  5.    ClientLeft      =   1110
  6.    ClientTop       =   2445
  7.    ClientWidth     =   5055
  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     =   1935
  20.    ScaleWidth      =   5055
  21.    Begin VB.PictureBox picResult 
  22.       Height          =   495
  23.       Left            =   120
  24.       ScaleHeight     =   435
  25.       ScaleWidth      =   4755
  26.       TabIndex        =   7
  27.       Top             =   1320
  28.       Width           =   4815
  29.    End
  30.    Begin VB.CommandButton cmdProcess 
  31.       Caption         =   "Process College"
  32.       Height          =   375
  33.       Left            =   1680
  34.       TabIndex        =   6
  35.       Top             =   840
  36.       Width           =   1815
  37.    End
  38.    Begin VB.TextBox txtYear 
  39.       Height          =   285
  40.       Left            =   4320
  41.       TabIndex        =   5
  42.       Top             =   480
  43.       Width           =   615
  44.    End
  45.    Begin VB.TextBox txtState 
  46.       Height          =   285
  47.       Left            =   1680
  48.       TabIndex        =   3
  49.       Top             =   480
  50.       Width           =   375
  51.    End
  52.    Begin VB.TextBox txtCollege 
  53.       Height          =   285
  54.       Left            =   1680
  55.       TabIndex        =   1
  56.       Top             =   120
  57.       Width           =   3255
  58.    End
  59.    Begin VB.Label lblYear 
  60.       Alignment       =   1  'Right Justify
  61.       Caption         =   "Year founded:"
  62.       Height          =   255
  63.       Left            =   3000
  64.       TabIndex        =   4
  65.       Top             =   480
  66.       Width           =   1215
  67.    End
  68.    Begin VB.Label lblState 
  69.       Alignment       =   1  'Right Justify
  70.       Caption         =   "State (abbrev.):"
  71.       Height          =   255
  72.       Left            =   120
  73.       TabIndex        =   2
  74.       Top             =   480
  75.       Width           =   1455
  76.    End
  77.    Begin VB.Label lblName 
  78.       Alignment       =   1  'Right Justify
  79.       Caption         =   "Name of College:"
  80.       Height          =   255
  81.       Left            =   0
  82.       TabIndex        =   0
  83.       Top             =   120
  84.       Width           =   1575
  85.    End
  86. Attribute VB_Name = "frm9_1_4"
  87. Attribute VB_GlobalNameSpace = False
  88. Attribute VB_Creatable = False
  89. Attribute VB_PredeclaredId = True
  90. Attribute VB_Exposed = False
  91. Private Sub cmdProcess_Click()
  92.   'Demonstrate use of records
  93.   picResult.Cls
  94.   Dim college As collegeData
  95.   Call GetDat(college)
  96.   Call DisplayStatement(college)
  97. End Sub
  98. Private Sub DisplayStatement(school As collegeData)
  99.   Dim centry As Integer, when As String
  100.   century = 1 + Int(school.yearFounded / 100)
  101.   picResult.Print RTrim(school.nom); " was founded in the" & Str(century);
  102.   picResult.Print "th century in "; school.state
  103.   Dim university As collegeData
  104.   university.nom = "M.I.T."
  105.   university.state = "MA"
  106.   university.yearFounded = 1878
  107.   If school.yearFounded < university.yearFounded Then
  108.       when = "before "
  109.     Else
  110.       when = "after "
  111.   End If
  112.   picResult.Print RTrim(school.nom); " was founded ";
  113.   picResult.Print when; RTrim(university.nom)
  114. End Sub
  115. Private Sub GetDat(school As collegeData)
  116.   school.nom = txtCollege.Text
  117.   school.state = txtState.Text
  118.   school.yearFounded = Val(txtYear.Text)
  119. End Sub
  120.