Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var item in this.Controls)
- {
- // Reset Textbox
- if (item.GetType().Equals(typeof(TextBox)))
- {
- TextBox t = item as TextBox;
- t.Text = string.Empty;
- }
- // Reset Combobox
- if (item.GetType().Equals(typeof(ComboBox)))
- {
- ComboBox c = item as ComboBox;
- c.SelectedIndex = -1;
- c.ResetText();
- }
- // Reset RadioButton
- if (item.GetType().Equals(typeof(RadioButton)))
- {
- RadioButton r = item as RadioButton;
- r.Checked = false;
- }
- // Reset CheckedListBox
- if (item.GetType().Equals(typeof(CheckedListBox)))
- {
- CheckedListBox cl = item as CheckedListBox;
- foreach (int i in cl.CheckedIndices)
- {
- cl.SetItemCheckState(i, CheckState.Unchecked);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment