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
查看全文
相关阅读:
计算机中的进制和编码
操作系统简史
电脑结构和CPU、内存、硬盘三者之间的关系
电脑简史
使用开源my-deploy工具实现开发环境的代码自动化部署
使用Let’s Encrypt创建nginx免费SSL证书
VM ESXI 服务器虚拟化资料积累
python mysql连接函数
python日期格式转换小记
Python模块学习
原文地址:https://www.cnblogs.com/flashicp/p/774009.html
最新文章
Oracle_SQL99_连接查询
Oracle_子查询
Oracle_group by分组查询_深入
Oracle_创建用户_授予权限
Oracle_insert_delete_update
机器学习中的几个概念的关系
画出神经网络
机器学习概要
学习 HMM
NetworkX 使用(三)
热门文章
NetworkX 使用(二)
参考文献引用网页怎么标注 ?
解决 cl.exe 找不到 path 的问题
『度量学习』知识梳理
Openstack入坑指南
学习方法--提问
Ubuntu学习——第一篇
开始使用Pyhton
Pyhton的发展历程
从0和1到Python
Copyright © 2011-2022 走看看