Private Type Student
FirstName As String
LastName As String
Average As Single
End Type
Private Sub Form_Load()
Dim st() As Student, n As Integer, i As Integer, s As String
n = Val(InputBox("Please enter count of students :"))
ReDim st(1 To n)
For i = 1 To n
st(i).FirstName = InputBox("First Name :")
st(i).LastName = InputBox("Last Name :")
st(i).Average = Val(InputBox("Average :"))
Next
Open "data.txt" For Output As #1
For i = 1 To n
Write #1, st(i).FirstName, st(i).LastName, st(i).Average
Next
Close #1
n = 0
Erase st
Open "data.txt" For Input As #1
Do Until EOF(1)
n = n + 1
ReDim Preserve st(1 To n)
Input #1, st(n).FirstName, st(n).LastName, st(n).Average
s = s & st(n).FirstName & " " & st(n).LastName & " " & CStr(st(n).Average) & vbNewLine
Loop
Close #1
MsgBox s
End Sub