(已经解决)敬请各位高手解决vb.net(vs2010)如何使读取TXT文件能正常显示汉字的问题。谢谢。
以下代码是打开(vs2010)→新建项目→双击新建按钮:(以下代码是一次性读取TXT文件内容,但显示汉字为乱码如何解决?逐行读取TXT文件内容且能显示汉字的代码已经有,不在此讨论。)
Imports
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = "f:\rat.txt"
Dim file As New (s)
Dim words As String = file.ReadToEnd()
file.Close()
MsgBox(words)
End Sub
End Class
rat.zip
(551 Bytes)
[此贴子已经被作者于2017-6-26 11:02编辑过]