zoukankan
html css js c++ java
openFileDialog 选择文件
用OpenFileDialog选择文件:
/***选择文件***/
#region
/***选择文件***/
private
void
button1_Click(
object
sender, System.EventArgs e)
{
string
folderName
=
string
.Empty;
try
{
openFileDialog.InitialDirectory
=
@"
c:\
"
;
openFileDialog.RestoreDirectory
=
true
;
openFileDialog.Filter
=
"
(*.mdb)|*.*
"
;
openFileDialog.FilterIndex
=
1
;
DialogResult fileresult
=
openFileDialog.ShowDialog();
if
(fileresult
==
DialogResult.OK)
{
string
oldFilePath
=
openFileDialog.FileName;
//
System.IO.FileInfo fi = new System.IO.FileInfo(oldFilePath);
//
if(fileinfo!=null)
//
{
if
(oldFilePath.IndexOf(
"
.mdb
"
)
>
0
)
{
this
.txtOldfile.Text
=
oldFilePath;
string
strFilePath
=
System.IO.Path.GetDirectoryName(oldFilePath);
this
.p_mdbFullName
=
oldFilePath;
……
p_savePath
=
Directory.GetParent(oldFilePath).ToString();
}
else
{
MessageBox.Show(
this
,
"
请选择将要操作的Access数据库文件
"
,
"
提示信息
"
,MessageBoxButtons.OK,MessageBoxIcon.Error);
}
//
}
}
else
{
return
;
}
}
catch
(Exception err)
{
MessageBox.Show(
this
,err.Message,
"
选择文件
"
,MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
#endregion
查看全文
相关阅读:
c#缓存技术(Dictionary)
反射Reflection创建
SQL Server手注之延时型盲注
MySQL——事务
MySQL——NULL值处理
MySQL——连接的使用
SQL server手注之报错注入
SQL Serves手注之联合查询注入
MySQL手注之ROOT权限处理
MySQL——正则表达式
原文地址:https://www.cnblogs.com/flashicp/p/774009.html
最新文章
mybatis前奏曲
动态规划之矩阵链乘法
python常用模块之random模块3
python的collection系列-counter
练习-python集合set
Python的set集合浅析
模块绝对路径使用
Python文件基本操作
Python字符串部分源码分析
Python字典部分源码分析,字典是无序的
热门文章
Python元组部分源码分析,元组和列表是可以相互转换的
python列表部分源码分析
练习-三级菜单
nicEditors使用方法
EasyUI Parser 解析器
EasyUI动态加载panel,并给panel添加内容
css样式加载顺序
EasyUI 二次加载toolbar异常问题解决
常用JS小知识汇总
封装Jquery 合并table中任何同列数据
Copyright © 2011-2022 走看看