程序界面
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//"E:\study\mydatabase\学生个人数据库.accdb"
if (openFileDialog1.ShowDialog()==DialogResult.OK)
{
string f_all = openFileDialog1.FileName;
string f_path = f_all.Substring(0, f_all.LastIndexOf("\\") 1);
string f_name = f_all.Substring(f_all.LastIndexOf("\\") 1, f_all.LastIndexOf(".") - (f_all.LastIndexOf("\\") 1));
string f_ex = f_all.Substring(f_all.LastIndexOf(".") 1, f_all.Length - (f_all.LastIndexOf(".") 1));
label1.Text = "文件路径:" f_path;
label2.Text = "文件名:" f_name;
label3.Text = "扩展名:" f_ex;
}
}
}
}