User control shows error

  • Thread starter Thread starter Ross
  • Start date Start date
R

Ross

hi,

I have a Windows Form (in VB.NET) with a panel that
includes a User Control that I have made.

It used to work fine, but now, I have the following
problem:

The programs compiles and works fine.
But when I look at the form in DESIGN VIEW,
it does not display the UserControl, but the following
error message: Object Reference not set to an instance of
an object.

Any idea why I have this???

thanks,

Ross
 
hi,

I had a similar problem and it was caused by uninitialised
variables in my code. When I used the control in my code I
created it using a constructor with parameters which
initialized the variables. Everything worked fine. The
designer however calls the default constructor for the
control and there I had not initialized all the necessary
variables so an NullReferenceException was generated when
the designer executed code that used these variables.

Marcello
 
Back
Top