已找到答案了:
For i As Long = 1 To 100
tmp = Right("000" + LTrim(Str(i)), 4)
Using outf_sw As StreamWriter = New StreamWriter(test_f, FileMode.Append)
outf_sw.WriteLine(tmp)
End Using
Next
如果去掉參數 FileMode.Append 就是重新開檔,會將原有檔案,重新複寫.
如下:
Using outf_sw As StreamWriter = New StreamWriter(test_f)
outf_sw.WriteLine(tmp)
End Using