Private Sub Command1_Click()
Dim fileNum As Integer
Dim fileContent As String
Dim fileInfo() As String
Dim tempData As String
fileNum = FreeFile
Open "C:\form.txt" For Binary As #fileNum
fileContent = Space(LOF(fileNum)) '
Get #fileNum, , fileContent
Close fileNum
fileInfo = Split(fileContent, vbCrLf) 'split函数根据vbCrLf(回车换行)来将fileContent分隔成数组
Text1.Text = fileInfo(0)
End Sub
想问一下高手,因为觉得这句话的Space只是返回空格的长度,为什么上面的程序一定要“fileContent = Space(LOF(fileNum)) ”这句话才能不报错运行?
而下面的fileInfo = Split(fileContent, vbCrLf)这句程序,是将fileContent的内容分隔成数组,与上面fileContent = Space(LOF(fileNum)) 这句程序有必然的关系吗?
慕的地6264312
呼啦一阵风