vb读取txt文件
我想用vb读取txt文件,文件里面只有一行。将读取出来的内容赋值给TextBox。
求大神帮忙
[解决办法]
Private Sub Command1_Click()
Open "F:\1.txt" For Input As #1
Line Input #1, textline
Text1.Text = textline
Close #1
End Sub
Private Sub cmd_Click()
Dim fileName As String
Dim fileNo As Integer
Dim fline As String
Dim strAll As String
fileNo = FreeFile()
Open "C:\1.txt" For Input As fileNo
Do While Not EOF(fileNo )
Line Input #fileNo , fline
strAll = strAll + fline
Loop
Close fileNo
text1.text= strAll
End Sub