Call this method in clear button event. pass that panel in method argument
public void Control(System.Windows.Forms.Panel Pan)
{
foreach (System.Windows.Forms.Control ctl in Pan.Controls)
{
if (ctl.GetType().ToString().Contains("TextBox"))
{
((System.Windows.Forms.TextBox)ctl).Clear();
}
if (ctl.GetType().ToString().Contains("ComboBox"))
{
((System.Windows.Forms.ComboBox)ctl).SelectedIndex = -1;
}
}
}
No comments:
Post a Comment