VB6關於文字讀取寫出
假設我有個文字檔案內容為123
456
789
我該如何讓VB讀取此文字檔並一行一行寫出 。
本帖最後由 YYYpo 於 2020-2-29 11:17 編輯
VB6的話,我提供我之前寫的,給你參考Private Sub Command1_Click()
On Error GoTo errHandle
CommonDialog1.ShowOpen
CommonDialog1.Filter = "文字處理檔案 (*.txt)|*.txt|"
Open CommonDialog1.FileName For Input As #1
While Not EOF(1)
Input #1, textline
Text2.Text = Text2.Text + textline + Chr(13) + Chr(10)
Wend
Close #1
Exit Sub
errHandle:
MsgBox Err.Description, vbCritical, "讀取資料失敗!"
End Sub希望對你有幫助
頁:
[1]