C#开发winform中OpenFileDialog的运用还可以多选
来源:互联网 发布:什么软件可以泡妞 编辑:程序博客网 时间:2024/06/05 02:00
原文地址: http://blog.csdn.net/njust_qhzt/article/details/8810315
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Runtime.InteropServices;
using System.IO;
private void button4_Click(object sender, System.EventArgs e)
{
Stream mystream;
OpenFileDialog openfiledialog1=new OpenFileDialog();
openfiledialog1.Multiselect=true;//允许同时选择多个文件
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)
{
this.textBox2.Text="";
for(int fi=0;fi<openfiledialog1.FileNames.Length;fi++)
{
this.textBox2.Text+=openfiledialog1.FileNames[fi].ToString();
}
mystream.Close();
}
}
}
C#通过文件路径获取文件名
string fullPath = @"/WebSite1/Default.aspx";
string filename = System.IO.Path.GetFileName(fullPath);//文件名 “Default.aspx”
string extension = System.IO.Path.GetExtension(fullPath);//扩展名 “.aspx”
string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(fullPath);// 没有扩展名的文件名 “Default”
string str1 = "1234567";
string str2= str1.SubString(0,3); // str2="123";
string str3 = str1.SubString(2,3); //str3 = "345";
SubString(m, n) ; m为需要截取的字符串索引位置, n为 截取长度
- C#开发winform中OpenFileDialog的运用还可以多选
- C#开发winform中OpenFileDialog的多选
- C# winform OpenFileDialog实例
- C# Winform OpenFileDialog 控件
- C#开发:openfiledialog的使用
- C#开发:openfiledialog的使用
- C#开发:openfiledialog的使用
- C#开发:openfiledialog的使用
- C#开发:openfiledialog的使用
- C#开发:openfiledialog的使用
- C#中OpenFileDialog的使用
- c#中OpenFileDialog的使用
- C#在WinForm中关于openfiledialog选定的数据插入到DataGridView中的代码
- OpenFileDialog的一些运用
- C#中colorDialog、fontDialog、openFileDialog的用法
- C#中 openfiledialog 和 FolderBrowserDialog 的使用
- WINFORM 中OpenFileDialog 得到文件名的小小总结
- 关于c#的OpenFileDialog,同时选择多个图片,同时可以翻页预览
- 【OC06】类目、延展、协议、计时器(连载八)
- NSArray和NSMutableArray
- typeof() test demo
- ADB not responding. If you'd like to retry, then please manually kill “adb.exe” and click 'Restart'
- 南邮 OJ 1484 烧饼重叠问题
- C#开发winform中OpenFileDialog的运用还可以多选
- hdu 5344 (多校联赛) MZL's xor --- 位运算
- UI04_Touch
- 南邮 OJ 1492 Nasty Hacks
- java ClassLoader 详解
- UI_UILTView
- 三证是什么?
- 南邮 OJ 1494 Card Trick
- C#文件操作总结