Dim PathUserData As String = Application.StartupPath & "\实操统计sql.txt"
TextTB.Text = System.IO.File.ReadAllText(PathUserData)
‘或者用 System.IO.File.ReadAllText(PathUserData, System.Text.Encoding.UTF8)
上面这个是读取
System.IO.File.ReadAllText(PathUserData, System.Text.Encoding.UTF8) 此用法是把编码方式转为UTF8
写入如下:
Dim PathUserData As String = Application.StartupPath & "\实操统计sql.txt"
Dim t As System.IO.StreamWriter = New System.IO.StreamWriter(PathUserData, True, System.Text.Encoding.UTF8)
t.Write(TextTB.Text)
t.Close()
- 1
- 2
- 3
- 4
追加如下:
Dim PathUserData As String = Application.StartupPath & “\实操统计sql.txt”
Dim t As System.IO.StreamWriter = New System.IO.StreamWriter(PathUserData, True, System.Text.Encoding.UTF8)
t.WriteLine(TextTB.Text)
t.Close()
同样的,你可vb.net教程以把
System.Text.Encoding.UTF8
- 1