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-1-2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-20  |  2.5 KB  |  85 lines

  1. VERSION 5.00
  2. Begin VB.Form frmInvent 
  3.    Caption         =   "Inventions"
  4.    ClientHeight    =   1704
  5.    ClientLeft      =   1092
  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     =   1704
  20.    ScaleWidth      =   3108
  21.    Begin VB.ListBox lstInvents 
  22.       Height          =   624
  23.       Left            =   360
  24.       Sorted          =   -1  'True
  25.       TabIndex        =   0
  26.       Top             =   120
  27.       Width           =   2415
  28.    End
  29.    Begin VB.Label lblWhen 
  30.       Height          =   255
  31.       Left            =   1080
  32.       TabIndex        =   4
  33.       Top             =   1320
  34.       Width           =   1095
  35.    End
  36.    Begin VB.Label lblYear 
  37.       Caption         =   "Year"
  38.       Height          =   255
  39.       Left            =   360
  40.       TabIndex        =   3
  41.       Top             =   1320
  42.       Width           =   495
  43.    End
  44.    Begin VB.Label lblWho 
  45.       Height          =   255
  46.       Left            =   1080
  47.       TabIndex        =   2
  48.       Top             =   960
  49.       Width           =   2295
  50.    End
  51.    Begin VB.Label lblInventor 
  52.       Caption         =   "Inventor"
  53.       Height          =   255
  54.       Left            =   120
  55.       TabIndex        =   1
  56.       Top             =   960
  57.       Width           =   735
  58.    End
  59. Attribute VB_Name = "frmInvent"
  60. Attribute VB_GlobalNameSpace = False
  61. Attribute VB_Creatable = False
  62. Attribute VB_PredeclaredId = True
  63. Attribute VB_Exposed = False
  64. 'In the (Declarations) section of (General)
  65. Dim inventor(0 To 10) As String
  66. Dim yr(0 To 10) As Integer
  67. Private Sub Form_Load()
  68.   Dim what As String, who As String, when As Integer, index As Integer
  69.   Open App.Path & "\INVENTOR.TXT" For Input As #1
  70.   index = 0
  71.   Do While (index < UBound(inventor)) And (Not EOF(1))
  72.     Input #1, what, who, when
  73.     index = index + 1
  74.     lstInvents.AddItem what
  75.     lstInvents.ItemData(lstInvents.NewIndex) = index
  76.     inventor(index) = who
  77.     yr(index) = when
  78.   Loop
  79.   Close #1
  80. End Sub
  81. Private Sub lstInvents_Click()
  82.   lblWho.Caption = inventor(lstInvents.ItemData(lstInvents.ListIndex))
  83.   lblWhen.Caption = Str(yr(lstInvents.ItemData(lstInvents.ListIndex)))
  84. End Sub
  85.