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
查看全文
相关阅读:
web api authentication
平常项目中缓存使用经验和遇到过的问题(3)
平常项目中缓存使用经验和遇到过的问题(2)
平常项目中缓存使用经验和遇到过的问题(1)
DllImport attribute的总结
人生路上对我影响最大的三位老师
自我介绍
7-1 币值转换 (20 分)
7-1 打印沙漏 (20 分)
form表单自动提交
原文地址:https://www.cnblogs.com/flashicp/p/774009.html
最新文章
python 004 执行环境对比
python 003 os模块 example
python 002 文件输入输出
python (001)----列表
老男孩Day1作业(二):三级菜单
老男孩Day1作业(一):编写登录接口
忆高中三位良师
初识VO、DTO、DO、PO实体类
spring boot日志分级别配置logback-spring.xml
mybatis plus + druid多数据源(使用dynamic实现)
热门文章
编码:隐匿在计算机软硬件背后的语言(1)--编码到二进制数字系统
编码:隐匿在计算机软硬件背后的语言(0)--前言
深入理解计算机系统(2)--计算机系统漫游
博客相关
深入理解计算机系统(1)--hello world程序的生命周期
学习的原因
c#excel的操作例子
Sql Server事务简单用法
angularJS中的Promise对象($q)的深入理解
Windows下nodejs 模块配置 全局模式与本地模式的区别
Copyright © 2011-2022 走看看