【winform学习】:获取文件路径
OpenFileDialog of1 = new OpenFileDialog();
if (of1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = of1.FileName;
}
FileStream fs1 = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read);
StreamReader sw1 = new StreamReader(fs1);
textBox2.Text = sw1.ReadToEnd();
sw1.Close();
fs1.Close();
作者:幸福的笨笨熊
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

浙公网安备 33010602011771号