User control shows error

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
 
M

Marcello Gandolfi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top