一个简单的打开文档对话框
来源:互联网 发布:小霸王网络机顶盒 编辑:程序博客网 时间:2024/05/19 05:32
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form//在form类中实例一个form1
{
public Form1()
{
InitializeComponent();//初始化
}
private void button1_Click(object sender, EventArgs e)//对click事件进行描述
{
openFileDialog1.Filter = "*.txt|*.txt";//选择一个文本,多个文本是filenames;
DialogResult dr = openFileDialog1.ShowDialog();//显示打开文件对话框
if (dr == DialogResult.OK)//如果你按的按钮是ok
{
richTextBox1.Text = System.IO.File.ReadAllText(openFileDialog1.FileName, Encoding.Default);//向richtext中添加你所选择的文本
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form//在form类中实例一个form1
{
public Form1()
{
InitializeComponent();//初始化
}
private void button1_Click(object sender, EventArgs e)//对click事件进行描述
{
openFileDialog1.Filter = "*.txt|*.txt";//选择一个文本,多个文本是filenames;
DialogResult dr = openFileDialog1.ShowDialog();//显示打开文件对话框
if (dr == DialogResult.OK)//如果你按的按钮是ok
{
richTextBox1.Text = System.IO.File.ReadAllText(openFileDialog1.FileName, Encoding.Default);//向richtext中添加你所选择的文本
}
}
}
}
- 一个简单的打开文档对话框
- Unity3d制作一个简单的打开保存对话框-按钮2
- Unity3d制作一个简单的打开保存对话框-按钮2
- 一个打开对话框的函数
- qt4:打开文件对话框的简单用法
- Unity3d制作一个简单的打开保存对话框-编写核心代码(1)
- 一个简单的对话框JDialog
- 如何打开一个新的对话框
- 一个打开文件对话框的小技巧
- 一个单文档应用程序,怎样实现“打开时,弹出一个对话框,而不是单文档”
- VC基于文档视图打开/保存对话框的重载
- 如何改变VC6文档程序默认的打开文件对话框
- Photoshop脚本 > 打开一个存在的文档
- Photoshop脚本 > 打开一个存在的文档
- 如何让一个打开的文档成为活动文档
- 如何让一个打开的文档成为活动文档
- 如何让一个打开的文档成为活动文档
- js+Css实现的一个简单对话框
- Android横竖屏切换小结
- 安装glibc库
- Android PNG渐变背景图片失真问题
- 中国联通被指乱扣费 返还金额限制用
- safari css visual effects guide 之3d transforms
- 一个简单的打开文档对话框
- Intent跳转到系统应用中的拨号界面、联系人界面、短信界面及其他
- C++异常处理
- sh 脚本里执行的export不起作用
- 好久不来了。
- 常用分页函数辅助类
- java获取classpath路径
- org.hibernate.NonUniqueObjectException
- 4个数计算24点