FileDialog简单使用demo
2011-01-04 11:07
351 查看
private void button1_Click(object sender, System.EventArgs e) { Stream myStream = null; 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) { try { if ((myStream = openFileDialog1.OpenFile()) != null) { using (myStream) { // Insert code to read the stream here. } } } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } }
相关文章推荐
- FileDialog简单使用demo
- MyBatis简单使用的demo
- WebRTC VoiceEngine使用简单Demo
- Wex5使用sqlite简单demo
- SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 SignalR 简单示例 通过三个DEMO学会SignalR的三种实现方式 SignalR推送框架两个项目永久连接通讯使用 SignalR 集线器简单实例2 用SignalR创建实时永久长连接异步网络应用程序
- [Android | 小代码] 天气预报 简易Demo json解析数组+对象 Gson+Volley简单使用
- AngryBird简单开发实现(一),使用JBox2D-2.1.2简单开发的demo
- RDLC使用手册_RDLC简单Demo
- APIDemo学习笔记——Android上几种简单的Animation使用方法(二)
- 使用pureMVC构建简单的游戏demo
- android 开源图表库MPChart最简单使用方法示例教程Demo--折线图 柱状图
- WebRTC VoiceEngine使用简单Demo
- 使用UICollectionView和UITableView混合布局,完成简单天气demo
- 使用Kotlin实现Android简单Demo,对比JAVA实现分析具体语法不同之处(一)
- 使用VC与GCC操作SQLite数据库的最简单Demo
- 转:android surface简单使用Demo
- echarts在.Net中使用实例(一) 简单的Demo
- 前端mock数据使用简单demo
- 使用游标循环表的简单DEMO
- Java 集合:TreeMap 的使用(不包括原理,仅仅是简单的使用 demo)