Private Type student
sno As Integer
sname As String * 6
End Type
Dim stu As student
Dim stunum As Integer
Private Sub Command1_Click()
Open App.Path & "\1.dat" For Random As #1 Len = Len(stu)
stunum = LOF(1) / Len(stu)
stu.sno = Val(Text1.Text)
stu.sname = Text2.Text
stunum = stunum + 1
Put #1, stunum, stu
End Sub
Private Sub Command2_Click()
For i = 1 To stunum
Get #1, i, stu
List1.AddItem stu.sname & stu.sno
Next i
Close #1
End Sub