Winform选择目录路径与选择文件路径
2013-05-06 12:59
465 查看
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { publicpartialclass SelectFolder: Form { public SelectFolder() { InitializeComponent(); } privatevoid btnSelectPath_Click(object sender, EventArgs e) //弹出一个选择目录的对话框 { FolderBrowserDialog path = new FolderBrowserDialog(); path.ShowDialog(); this.txtPath.Text = path.SelectedPath; } privatevoid btnSelectFile_Click(object sender, EventArgs e) //弹出一个选择文件的对话框 { OpenFileDialog file = new OpenFileDialog(); file.ShowDialog(); this.txtFile.Text = file.SafeFileName; } } }winforms 的openFileDialog1能实现 选择文件夹里面的多个<文件名>一次导入到LISTBOX下呢 !this.openFileDialog1.Multiselect = true;this.openFileDialog1.ShowDialog();foreach(string fName in this.openFileDialog1.FileNames){ this.listBox1.Items.Add(fName);}读取选择好的,文件全地址及名称 OpenFileDialog openfiledialot = new OpenFileDialog(); openfiledialot.ShowDialog(); this.textBox1.Text = openfiledialot.FileName.ToString();
相关文章推荐
- Winform选择目录路径与选择文件路径
- C# WinForm 选择目录路径和文件路径
- Winform选择目录路径与选择文件路径
- Winform选择目录路径与选择文件路径
- Winform选择目录路径与选择文件路径
- c#winform选择文件,文件夹,打开指定目录方法
- C#winForm窗体,以窗口对话形式选择文件夹、文件路径
- C# winform中选择本地文件,并获取其路径
- WPF 获取文件夹路径,目录路径,复制文件,选择下载文件夹/目录
- c#winform选择文件,文件夹,打开指定目录方法
- C# Winform选择目录路径(FolderBrowserDialog) 与选择文件名称
- Winform窗体文本框实现拖拽获得目录或文件路径(C#)
- c#Winform程序调用app.config文件配置数据库连接字符串 SQL Server文章目录 浅谈SQL Server中统计对于查询的影响 有关索引的DMV SQL Server中的执行引擎入门 【译】表变量和临时表的比较 对于表列数据类型选择的一点思考 SQL Server复制入门(一)----复制简介 操作系统中的进程与线程
- c# winform 路径选择和文件读写
- Qt-编程模块 001: 浏览(选择)、打开 文件和文件夹(目录) --- 如何让按钮**记忆上次打开的文本路径**的功能
- c#winform选择文件,文件夹,打开指定目录方法
- MFC选择目录SHBrowseForFolder选择文件CFileDialog对话框设置默认路径
- c#winform选择文件,文件夹,打开指定目录方法
- SVN导出文件的时候选择路径不小心选择了盘符根目录
- JFileChooser 选择目录,选择保存路径,并对保存文件类型进行更改: