private void SaveControls(IControlSave cs) { foreach (Control c in groupBox1.Controls) { SaveLoad.saveControl(cs, c); } foreach (Control c in groupBox2.Controls) { SaveLoad.saveControl(cs, c); } cs.SaveTextBox(labelDirectory.Name, labelDirectory.Text); }
public static void saveControl(IControlSave cs, Control c) { if (c is TextBox) { cs.SaveTextBox(c.Name, c.Text); } else if (c is ComboBox) { cs.SaveComboBox(c.Name, c.Text); } else if (c is CheckBox) { cs.SaveCheckBox(c.Name, (c as CheckBox).Checked); } }