【正确答案】根据题意,将一个Text控件、一个Labell控件和一个Command控件添加到窗体上,Text的名称为Text1,Text属性为空,MultiLine属性为True,ScrollBar属性为2,Labell的名称为Label1,Caption属性为空,Command的名称为Command1,Caption属性为“读入文件”,设置完成后双击Command1命令按钮,编写如下代码:
Private Sub Command1_Click()
Dim str AS String
Dim temp As String
Str=" "
Open"./in.txt" For
Input As#1 '打开文件准备读取
While EOF(1)=False '判断是否读到文件尾
Input # 1,temp '读取字符串
str=str+temp '将读取的字符串放入输出字符串中
Wend
Close # 1 '关闭文件
Text1.
Text=str '在Text1中显示输出字符串
Label1.
Caption=
Len(str) '将字符串长度在Label1中显示出来
End Sub
单击
