Hi i am having a bit of trouble with reading a random file i can get it to write to a file but not get data back
Code:
General
Option Explicit
Dim outRec As PhoneRec
Dim position As Integer
Dim lastrecord As Integer
Dim inRec As PhoneRec
_________________________________________
Form Load
Dim intcnt As Integer
For intcnt = 0 To 7
txtInput(intcnt).Text = ""
Next intcnt
Open "c:\test.txt" For Random As #1
Do While Not EOF(1)
Get #1, , outRec
Loop
lastrecord = Seek(1) - 1
position = lastrecord
_________________________________________
cmdRead
On Error GoTo ErrRtn
Dim intcnt As Integer
Dim intcnt2 As Integer
Dim position As Integer
position = txtInput(0).Text
Get #1, position, inRec
txtInput(1).Text = inRec.Fname
txtInput(2).Text = inRec.Lname
txtInput(3).Text = inRec.Street
txtInput(4).Text = inRec.city
txtInput(5).Text = inRec.State
txtInput(6).Text = inRec.zip
txtInput(7).Text = inRec.Phone
ErrRtn:
Resume Next
_________________________________________
Module
Type PhoneRec
Personid As Integer
Fname As String * 15
Lname As String * 15
Street As String * 20
city As String * 15
State As String * 10
zip As String * 8
Phone As String * 6
End Type
my cmdWrite works fine and puts the data from the textboxes into the file but doesn't read them back when i click the cmdRead can anyone see any problems in the code.
this is in VB6 by the way