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
查看全文
相关阅读:
0101
正则表达式 re模块
经典算法>>mor-c3 / 删除排序
网络编程
面向对象>>类(三大特性:继承多态封装)>>反射,内置函数/方法,
经典算法>冒泡 和二分法
Apollo 5.0 障碍物行为预测技术
一种新颖鲁棒的自动驾驶车辆换道轨迹规划方法
自动驾驶中轨迹规划的探索和挑战
Lattice Planner规划算法
原文地址:https://www.cnblogs.com/flashicp/p/774009.html
最新文章
webstorm使用帮助(转自http://my.oschina.net/longteng2013/blog/138010),另外有部分内容摘自其它人博客
Web学习资源及手册查询整理
CSS块级元素与行级元素(转载)
网址
我的菜谱:鱼香肉丝
自定义控件UITypeEditor
自定义控件类型转换器TypeConverter和ExpandableObjectConverter
自定义控件的常用属性
DES数据加密与文件加密Template
the first day
热门文章
关于数据仓库生命周期 与 传统系统开发生命周期的区别
infa日志获取视图脚本
博客转移说明
页面加载
mysql命令行总结(一)
node && mysql 结合使用
cvte的面试的一道题目
前言
(二)关于ajax那些事
(一)关于面向对象----继承
Copyright © 2011-2022 走看看