Lets Say I have a FormBase Class that is inherited from ‘Form’, and I have winforms Form that inherit from FormBase, how do I get access and manipulate the Controls in the Child Form as follows:
public class FormBase : Form
{
protected FormBase()
{
//for each Control in Child form Controls
//Do something with the Controls
}
}
public partial class Products : FormBase
{
public Products()
{
InitializeComponent();
}
}
You should not access the controls of the child form in the constructor of the base form. Because base constructor will be run first and child constructor after that.
Instead you should do