VERSION 5.00
Begin VB.Form frmRecordList2 
   ClientHeight    =   3165
   ClientLeft      =   60
   ClientTop       =   375
   ClientWidth     =   4680
   LinkTopic       =   "Form9"
   ScaleHeight     =   3165
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.ListBox List1 
      Height          =   645
      Left            =   780
      TabIndex        =   7
      Top             =   540
      Width           =   3375
   End
   Begin VB.Label Label1 
      Caption         =   "ID"
      Height          =   255
      Left            =   840
      TabIndex        =   6
      Top             =   1440
      Width           =   1695
   End
   Begin VB.Label lblID 
      BackColor       =   &H80000009&
      Height          =   315
      Left            =   2520
      TabIndex        =   5
      Top             =   1380
      Width           =   1575
   End
   Begin VB.Label Label3 
      Caption         =   "Name"
      Height          =   255
      Left            =   840
      TabIndex        =   4
      Top             =   1920
      Width           =   1575
   End
   Begin VB.Label lblName 
      BackColor       =   &H80000009&
      Height          =   315
      Left            =   2520
      TabIndex        =   3
      Top             =   1860
      Width           =   1575
   End
   Begin VB.Label Label5 
      Caption         =   "Telephone Number"
      Height          =   375
      Left            =   840
      TabIndex        =   2
      Top             =   2400
      Width           =   1575
   End
   Begin VB.Label lblTelNum 
      BackColor       =   &H80000009&
      Height          =   315
      Left            =   2520
      TabIndex        =   1
      Top             =   2340
      Width           =   1575
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      Caption         =   "View Records"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   4995
   End
End
Attribute VB_Name = "frmRecordList2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
    Dim fileName As String
    Dim telNum() As Long ' variable for holding the telephone number
    Dim firstname() As String ' variable for holding the name
    Dim id() As Integer ' variable for holding the id

Private Sub List1_Click()
    Dim index As Integer
    index = List1.ListIndex
    lblID = id(index) 'display id in the label
    lblName = firstname(index) 'display name in the label
    lblTelNum = telNum(index) 'display telephone number in the label
End Sub

Private Sub Form_Load()
    Dim i As Integer
    i = 0
    fileName = App.Path & "\record.txt"  ' specify file name.

    Open fileName For Input As #1 'Open file.
    Do While (Not EOF(1))
        ReDim Preserve id(i + 1)
        ReDim Preserve firstname(i + 1)
        ReDim Preserve telNum(i + 1)
        Input #1, id(i), firstname(i), telNum(i)  'read data from file into variables.
        List1.AddItem id(i)
        i = i + 1
    Loop
    Close   'Close all open files 

End Sub




