I am trying to create a form that writes a .dat file, and then another form that reads the file and outputs the fields into a list box. The creation seems to have gone fine, but reading the file seems to not work so much. Can anyone tell me what I'm doing wrong? Here's what I have so far:
Code:
Private Sub cmdCreate_Click() Open "c:\users\brian\Documents\School\CPT 323\friends.dat" For Output As #1 Write #1, 1, "phone number", "first name", "last name" Write #1, 2, "111-111-1111", "Michael", "Massey" Write #1, 3, "222-222-2222", "Brian", "Tjarks" Write #1, 4, "333-333-3333", "George", "Fuller" Close 1 End Sub Private Sub cmdRead_Click() Dim phoneNumber As String Dim firstName As String Dim lastName As String Open "friends.dat" For Input As #1 Do Until EOF(1) Input #1, phoneNumber, firstName, lastName lstFriends.AddItem "phoneNumber " & _ "firstName " & "lastName" Loop Close 1 End Sub
Comment