有下列程序,程序运行后,单击“Command1”按钮,在列表框List1中显示的第一行和第二行的结果分别是 【13】 和 【14】 ,最后一行的结果是 【15】 。
Type type_a
chr1 As String*1
num1 As Integer
End Type
Private Sub Command1_Click()
Dim testdata As type_a, n As Integer
Dim f1 As Integer, c()As String*1
f1=FreeFile
Open "d:\data. txt" For Random As #f1 Len=Len(testdata)
n=1
For I=97 To 102
ReDim Preserve c(n)
c(n)=Chr(I)
testdata. chr1=c(n)
testdata. num1=I
n=n+1
Put #f1, , testdata
Next I
Seek #f1, 1
For I=1 To UBound(c)
Get #f1, , testdata
List1. AddItem testdata. chr1 & testdata num1
Next I
List1. AddItem UBound(c)
Close
End Sub