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
查看全文
相关阅读:
s2sh的MVC执行流程和执行原理
码支付-个人支付接口-个人收款
notepad++ FTP同步插件【FanFtpTools】2.0
自己做的notepad++ FTP同步插件【FanFtpTools】
thinkphp高并发抢购代码测试-解决高并发下的超卖问题!
thinkphp5.0 与thinkphp5.1 db()函数的区别
thinkphp5.1 长连接-单例模式测试之二
thinkphp5.1长连接-单例模式测试!
php 全文搜索引擎-讯搜使用
在线WEB开发编辑器,edt.df5d.com
原文地址:https://www.cnblogs.com/flashicp/p/774009.html
最新文章
Node连接MySql返回数据给Https协议网站为什么不显示
Django app与mysql的使用
一行 Python 实现并行化 -- 日常多线程操作的新思路
Scrapy运行项目时出错:Scrapy 0.16.2 – no active project,Unknown command: crawl,Use "scrapy" to see available commands
解决scrapy fetch http://www.csdn.net ModuleNotFoundError No module named 'win32api'和ImportError DLL load failed找不到指定的模块
Scrapy安装错误:Microsoft Visual C++ 14.0 is required...
Python3爬虫获取
正则表达式30分钟入门教程
python3中自定义wsgi函数,make_server函数报错问题
block(块级元素)和 inline(内联元素) 的区别
热门文章
css(float浮动和clear清除)
新人工作半个月,闲下来整理下一些在工作中遇到的别人看来很简单的知识点
将博客搬至CSDN
eclipse搭建golang for windows
Javascript常用字符串判断函数
如何获取ResultSet的行数和列数
发现个很变态的css问题,记录下。
跟着8张思维导图学习javascript (转)
第三方登录授权说明
SpringMVC视频
Copyright © 2011-2022 走看看