private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { ExcelColumnDef = ExcelColumnDefs[comboBox1.SelectedIndex]; DS_ExcelSettingPars.DataSource = ExcelColumnDefs[comboBox1.SelectedIndex]; } catch { }; }
public UPDATE_FORM() { InitializeComponent(); string temp = Properties.Settings.Default.SettingParameters; try { if (temp != string.Empty) { ExcelColumnDef = Newtonsoft.Json.JsonConvert.DeserializeObject <Views.ExcelColumnDef>(temp); } } catch { } }
private void btnSetting_Click(object sender, EventArgs e) { //SettingForm.ExcelColumnDef = ExcelColumnDef; if (ExcelColumnDef == null) { ExcelColumnDef = new Views.ExcelColumnDef(); } SettingForm = new Views.SettingForm(ExcelColumnDef); if (SettingForm.ShowDialog() == DialogResult.OK) { ExcelColumnDef = SettingForm.ExcelColumnDef; Properties.Settings.Default.SettingParameters = Newtonsoft.Json.JsonConvert.SerializeObject(ExcelColumnDef); Properties.Settings.Default.Save(); } }
public SettingForm(ExcelColumnDef excelColumnDef) { InitializeComponent(); ExcelColumnDef = excelColumnDef; DS_ExcelSettingPars.DataSource = ExcelColumnDef; try { string temp = Properties.Settings.Default.ParameterHis; if (temp != string.Empty) ExcelColumnDefs = JsonConvert.DeserializeObject<List<ExcelColumnDef>>(temp); else ExcelColumnDefs = new List<ExcelColumnDef>(); } catch { } if (ExcelColumnDefs == null) return; for (int i = 0; i < ExcelColumnDefs.Count; i++) { comboBox1.Items.Add($"Setting {i + 1}"); } }