标签:textbox string c# wince wince编程
using System.IO;
private void button1_Click(object sender, EventArgs e) { string strFilePath = ""; OpenFileDialog fd = new OpenFileDialog(); fd.Filter = "文本文件(*.txt)|*.txt|All files (*.*)|*.*"; //过滤文件类型 //fd.InitialDirectory = Application.StartupPath + "\\Temp\\";//设定初始目录 //fd.ShowReadOnly = true; //设定文件是否只读 if (fd.ShowDialog() != DialogResult.OK) { return; } strFilePath = fd.FileName; if (!File.Exists(strFilePath)) { MessageBox.Show("抱歉!文件不存在,请重新输入文件名!"); return; } StreamReader strReader = new StreamReader(new FileStream(strFilePath, FileMode.Open, FileAccess.ReadWrite), Encoding.Default); //string strTemp = strReader.ReadLine(); string strTemp = strReader.ReadToEnd(); strReader.Close(); textBox1.Text = strTemp; }
WinCE的C#中使用StreamReader 来读取TXT文档,读取文本文档。,布布扣,bubuko.com
WinCE的C#中使用StreamReader 来读取TXT文档,读取文本文档。
标签:textbox string c# wince wince编程
原文地址:http://blog.csdn.net/anjoly/article/details/32123335