public void readControls(Control groupControl, ArrayList data) { //On récupère tous les controls du tabpage foreach (Control control in groupControl.Controls) { SimplifiedControl sc = null; if (control.GetType() == typeof(TextBox)) sc = new SimplifiedControl(control.Name, ((TextBox)control).Text, control.GetType()); else if (control.GetType() == typeof(Label)) sc = new SimplifiedControl(control.Name, ((Label)control).Text, control.GetType()); else if (control.GetType() == typeof(CheckBox)) sc = new SimplifiedControl(control.Name, ((CheckBox)control).Checked, ((CheckBox)control).Text, control.GetType()); else if (control.GetType() == typeof(RadioButton)) sc = new SimplifiedControl(control.Name, ((RadioButton)control).Checked, ((RadioButton)control).Text, control.GetType()); else if (control.GetType() == typeof(NumericUpDown)) sc = new SimplifiedControl(control.Name, ((NumericUpDown)control).Value, control.GetType()); else if (control.GetType() == typeof(GroupBox)) readControls(control, data); else if (control.GetType() == typeof(TabPage)) readControls(control, data); else if (control.GetType() == typeof(TabControl)) readControls(control, data); if (sc != null) data.Add(sc); } }
public void readControls(Control groupControl, ArrayList data) { //On récupère tous les controls du tabpage foreach (Control control in groupControl.Controls) { SimplifiedControl sc = null; if (control.GetType() == typeof(TextBox)) { sc = new SimplifiedControl(control.Name, ((TextBox)control).Text, control.GetType()); } else if (control.GetType() == typeof(CheckBox)) { sc = new SimplifiedControl(control.Name, ((CheckBox)control).Checked, control.GetType()); } else if (control.GetType() == typeof(RadioButton)) { sc = new SimplifiedControl(control.Name, ((RadioButton)control).Checked, ((RadioButton)control).Text, control.GetType()); } else if (control.GetType() == typeof(NumericUpDown)) { sc = new SimplifiedControl(control.Name, ((NumericUpDown)control).Value, control.GetType()); } else if (control.GetType() == typeof(ComboBox)) { sc = new SimplifiedControl(control.Name, ((ComboBox)control).SelectedIndex, control.GetType()); } else if (control.GetType() == typeof(GroupBox)) { readControls(control, data); } else if (control.GetType() == typeof(TabPage)) { readControls(control, data); } else if (control.GetType() == typeof(TabControl)) { readControls(control, data); } if (sc != null) { data.Add(sc); } } }