private void BtnSelectFile_Click(object sender, EventArgs e)
{
try
{
string fName = string.Empty;
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = "D:\\";//注意这里写路径时要用c:\\而不是c:\
openFileDialog.Filter = "EXE文件|*.exe|MSI文件|*.msi";
openFileDialog.RestoreDirectory = true;
openFileDialog.FilterIndex = 1;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
fName = openFileDialog.FileName;
}
labelFilepath.Text = fName;
}
catch (Exception ex)
{
log.WriteLog(ex.ToString());
}
finally
{
this.Visible = true;
tabControl.SelectedIndex = 2;
}
}