C# 从ini文件中读取文本到textbox,中文乱码问题
protectedvoidButton_get_Click(objectsender,EventArgse){stringFullFileName=@"F:\111.tx...
protected void Button_get_Click(object sender, EventArgs e)
{
string FullFileName = @"F:\111.txt";
string MyText = "", ch;
int a = 0;
//以打开,只读的方式创建文件流MyFile
FileStream MyFile = new FileStream(FullFileName, FileMode.Open, FileAccess.Read);
a = MyFile.ReadByte();
while (a != -1)
{
ch = ((char)a).ToString();
MyText = MyText + ch;
a = MyFile.ReadByte();
}
TextBox1.Text = MyText;
MyFile.Close();
} 展开
{
string FullFileName = @"F:\111.txt";
string MyText = "", ch;
int a = 0;
//以打开,只读的方式创建文件流MyFile
FileStream MyFile = new FileStream(FullFileName, FileMode.Open, FileAccess.Read);
a = MyFile.ReadByte();
while (a != -1)
{
ch = ((char)a).ToString();
MyText = MyText + ch;
a = MyFile.ReadByte();
}
TextBox1.Text = MyText;
MyFile.Close();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询