[C#]
protected void button1_Click(object sender, System.EventArgs e)
{
Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ; if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = openFileDialog1.OpenFile())!= null)
{
// Insert code to read the stream here.
myStream.Close();
}
}
}
protected void button1_Click(object sender, System.EventArgs e)
{
Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ; if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = openFileDialog1.OpenFile())!= null)
{
// Insert code to read the stream here.
myStream.Close();
}
}
}
解决方案 »
- 各位大侠们,帮小弟解决2个关于dev控件中grid控件的问题(在线等)
- Form1 Ori;这样定义的一个对象在内存中会分配空间吗,还是说他只是对象在内存中的地址
- C# 中 用sql数据库时使用 SqlDbType.VarChar access中使用出错
- showdailog后窗口自动关闭
- 已有Oracle数据库是否必须安装客户端?
- MDI子窗体如何充满整个父窗体内的空间
- 如何让窗口A永远在窗口B的上面
- 100分 求一套 进 销 存 系统,简单点也可以。
- 怎样得到应用程序的版本号?
- 我快被Process.Start()恶心死了,求大大们帮助。
- 把datagrid的数据保存成excel文件,在线等
- 关于工厂设计模式的疑惑
具体使用可以看这篇文章
http://dev.csdn.net/develop/article/29/29248.shtm