C++/CLI control null exceptions

  • Thread starter Thread starter dragonslayer008
  • Start date Start date
D

dragonslayer008

Hello group,

I'm making a custom control in C++/CLI. The control builds fine. To
test the control, I made a C# Forms application. On the Toolbox, I
right clicked and chose "Choose Items". I then browsed for my control
DLL and added it. The custom control now shows up in the toolbox. I
then drag this control onto the form.

I then get exceptions about null objects. I don't get this. How can
I get exceptions when the program isn't even running? Some of the
objects will be null until I "new" them...
 
Your control failed to load in Visual Studio
Set Visual Studio as your debug target to debug this problem.
 
Hello group,

I'm making a custom control in C++/CLI. The control builds fine. To
test the control, I made a C# Forms application. On the Toolbox, I
right clicked and chose "Choose Items". I then browsed for my control
DLL and added it. The custom control now shows up in the toolbox. I
then drag this control onto the form.

I then get exceptions about null objects. I don't get this. How can
I get exceptions when the program isn't even running? Some of the
objects will be null until I "new" them...

The program IS running... but the program, in this case, is Visual Studio
itself.

The forms designer instantiates your control with the default constructor
and then interrogates all of the properties using reflection.. You need to
make sure that all properties of your control are readable on a
default-constructed instance of your class or you won't be able to use it in
the designer.

-cd
 
Back
Top