winfrom 通过按钮选择文件
private void ExcelBtn_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = " Excel文件|*.xls";
if (ofd.ShowDialog() == DialogResult.OK)
{
this.ExcelText.Text = ofd.FileName;
}
}
}
//选择保存文件路径
private void PutBtn_Click(object sender, EventArgs e)
{
using (SaveFileDialog sfd = new SaveFileDialog())
{
sfd.Filter = "(*.xlsx)|*.xlsx";
private void PutBtn_Click(object sender, EventArgs e)
{
using (SaveFileDialog sfd = new SaveFileDialog())
{
sfd.Filter = "(*.xlsx)|*.xlsx";
sfd.Title = "结果输出:";
if (sfd.ShowDialog() == DialogResult.OK)
{
this.TB_Put.Text = sfd.FileName;
}
}
}
{
this.TB_Put.Text = sfd.FileName;
}
}
}