vb.txt中内容21.03 3.21
想要得到text1中21.03;text2中3.21,请问如何实现,以下代码实现不了
Open "C:\Documents and Settings\Administrator\桌面\vb.txt" For Input As #1
Do While Not EOF(1)
Text1 = Text1 + Input(1, #1)
Loop
Close #1

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim arr() As String, strS As String, sFile As String
    Open "C:\Documents and Settings\Administrator\桌面\vb.txt" For Input As #1
    Do While Not EOF(1)
    Line Input #1, sFile
     arr = Split(sFile, " ")
     Loop
    Text1 = arr(0) & "   " & arr(1)
    Close #1
    End Sub
      

  2.   

    Open "C:\Documents and Settings\Administrator\桌面\vb.txt" For Input As #1 
    dim s as string
    while eof(1)=false
    line input #1,s
    text1.text=text1.text+s+vbnewline
    wend
    close #1