选择 .dll 文件并按 OK 后,浏览对话框将关闭并重新打开。在它再次打开并按 OK 后,它会毫无问题地取值。
这是我的代码
private void btnBrowse_Click(object sender, EventArgs e) {
OpenFileDialog dllDialog = new OpenFileDialog();
dllDialog.Filter = "DLL Files|*.dll";
dllDialog.InitialDirectory = @"C:\";
dllDialog.Title = "Please select .dll file.";
if (dllDialog.ShowDialog() == DialogResult.OK) {
dllDialog.ShowDialog();
tbRepTempLibrary.Text = dllDialog.FileName;
} else {
MessageBox.Show("error");
}
}