vb的一段自定义函数,帮我解释下

来源:百度知道 编辑:UC知道 时间:2024/09/23 01:38:38
Sub OpenTxt(x As String)
Open x For Input As #1
Do While Not EOF(1)
Line Input #1, temp
Text1.Text = Text1.Text & temp & vbCrLf
Loop
Close #1
End Sub

Open x For Input As #1 打开x路径文件~
Do While Not EOF(1) 逐行读取文件内容 直到文件最后一行~
Line Input #1, temp 每行内容都在temp变量里~
Text1.Text = Text1.Text & temp & vbCrLf 将每行内容赋值给text控件
Close #1 关闭文件