您的位置:首页 > 编程语言 > VB

vb.net读写文本文件简单示例

2011-09-20 14:49 369 查看


Dim strFilePath As String =SaveFileDialog1.FileName
Dim sw As StreamWriter = New StreamWriter(strFilePath, True) 'true是指以追加的方式打开指定文件
For i = 0 To j
temp = i.ToString
sw.WriteLine(temp)
sw.Flush()
Next
sw.Close()
sw = Nothing



Dim line As String
Dim sr As StreamReader = New StreamReader(strPath, System.Text.Encoding.Default)
Do While sr.Peek() > 0
line = sr.ReadLine()
Loop
sr.Close()
sr = Nothing '构造函数new
Public Sub New(Path, Encoding)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: