silverlight 怎么读取文件夹
展开全部
写法:
OpenFileDialog openFileDlg = new OpenFileDialog();
openFileDlg.Multiselect = false;
openFileDlg.Filter = "文本文件(*.txt)|*.txt";
openFileDlg.ShowDialog();
FileInfo fileInfo = openFileDlg.File;
strFilePath = fileInfo.FullName;
StreamReader fileRead = new StreamReader(strFilePath, Encoding.UTF8);
textBox1.Text = fileRead.ReadToEnd();
fileRead.Close();
OpenFileDialog openFileDlg = new OpenFileDialog();
openFileDlg.Multiselect = false;
openFileDlg.Filter = "文本文件(*.txt)|*.txt";
openFileDlg.ShowDialog();
FileInfo fileInfo = openFileDlg.File;
strFilePath = fileInfo.FullName;
StreamReader fileRead = new StreamReader(strFilePath, Encoding.UTF8);
textBox1.Text = fileRead.ReadToEnd();
fileRead.Close();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询