snorlax snorlax - 4 years ago 95
C# Question

How can one refresh TabContol inner controls?

First, I read this Reset all the items in a form

It was a great help until I realised all my controls are inside a

containing itself several tabs in which there are all the common controls i.e. textbox, datetimepicker, datagrigview, etc....

Then I tried
but this deleted all tabs in the form.

How can I implement this Reset all the items in a form in a TabControl ?

Answer Source


foreach (Control c in GetAll(myTabControl))

in which ResetAllControls is the method in your referenced link and

public static IEnumerable<Control> GetAll(Control control)
    var controls = control.Controls.Cast<Control>();
    return controls.SelectMany(ctrl => GetAll(ctrl))

from the accepted answer of this question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download