[填空题] 建立一个通讯录的随机文件phonBook.txt,内容包括姓名、电话、地址和邮编,用文本框输入数据。单击“添加主记录”按钮command1时,将文本框数据写入文件,单击“显示”按钮Command2时,将文件中所有记录内容显示在立即窗口。
Private Type PerData
Name1 As String
Phon As String * 11
Address As String * 10
Posted As String * 6
End Type
___________________________’定义PerData类型的变量xData
Private Sub Form_Load()
Open "C:phonBook.txt"For Random As 1
End Sub
Private Sub Command1_Click()
xData. Name1=Text1.Text
xData. Phon=Text2.Text
________=Text3.Text ’地址
xData. PostCd=Text4.Text
Put #1, 1, xData
Text1.Text=" ":Text2.Text=""
Text3.Text="":Text4.Text=""
End Sub
Private Sub Command2_Click()
reno=LOF(1)/Len(xData)
i=1
Do While i<= reno
Get #1, i, xData
Debug.Print xData.Name 1,______, xData. Address, xData.