private
subcommand1_click()
'讀檔案
open
"d:a.txt
"for
inputas#
1dim
lines
asstring
dimnextline
asstring
dimi
asinteger
dowhile
noteof(1
)onerror
resume
next
line
input#1
, nextline
lines
=lines
&nextline
&chr(13
) &chr(10)
loop
close #
1text1.text
=lines
end sub
private
subcommand2_click()
'寫檔案
open
"d:a.txt
"for
output as#
1print#1
, text1.text
close #
1end sub
'如果要處理的是程式目錄所在的a.txt那麼應該是這樣寫:
'
讀寫TXT檔案
1 file.writealltext 寫入內容,可以指定編碼 寫入文字使用 file.writealltext 檔案路徑 例如 d 文字.txt 待寫入文字 public static void writetxtbyfiletext string filepath,string msg 2 fil...
VB讀寫檔案
vb讀寫檔案要用到以下語句 1 open語句開啟檔案。2 讀檔案使用line input input 以上為文字方式 和get 以上為二進位制方式 3 寫檔案使用print write 以上為文字方式 和put 以上為二進位制方式 4 close語句關閉檔案 5 二進位制方式下移動檔案位置使用see...
VB 讀寫檔案
引用 open f new.txt for input as 1 dim b as string b strconv inputb lof 1 1 vbunicode open 開啟檔案的路徑 for 開啟方式 這裡是讀取,下面的是寫入和建立 as 檔案號 close 1 以上為讀取檔案,以下為寫入...