public MainForm() { InitializeComponent(); comboBox_SendType.SelectedIndex = 0; FilePath = ConfigurationManager.AppSettings["FilePath"].ToString().Trim(); textBox_FilePath.Text = AppSettingUtils.GetAppSettingsValue("FilePath"); textBox_YHClientPath.Text = AppSettingUtils.GetAppSettingsValue("YHClientPath"); }
private void button_YHClientPath_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = false;//该值确定是否可以选择多个文件 dialog.Title = "请选择文件"; dialog.Filter = "EXE文件|*.exe;*.exe"; if (dialog.ShowDialog() == DialogResult.OK) { textBox_YHClientPath.Text = dialog.FileName; FilePath = dialog.FileName; AppSettingUtils.UpdateAppSettings("YHClientPath", dialog.FileName); } }