G
Guest
Hello,
When I add a User Control to a web form and then try to declare it in the
code as a private member it doesn't get instantiated. However with
'protected' it's OK!
For example I get a runtime error on the line indicated in
InitializeComponent() because the user control is null. However if I declare
it as 'protected' it's ok.
private myUserControl userControl;
....
InitializeComponent()
{
....
userControl.Click += new EventHandler(userControl_Click);
}
When I add a User Control to a web form and then try to declare it in the
code as a private member it doesn't get instantiated. However with
'protected' it's OK!
For example I get a runtime error on the line indicated in
InitializeComponent() because the user control is null. However if I declare
it as 'protected' it's ok.
private myUserControl userControl;
....
InitializeComponent()
{
....
userControl.Click += new EventHandler(userControl_Click);
}