adding a component

  • Thread starter Thread starter Jeroen Ceuppens
  • Start date Start date
J

Jeroen Ceuppens

Hi,
I want to add a component of these class :

public class OptiePanel : System.ComponentModel.Component

I put on this class in a constructor with in it lost of things to add like:
this.Container.Add(labelHoofd);

So if I want to add an object of this class in the main form, how should I
do it?

Because if I do this it will not work:

OptiePanel panelke=new OptiePanel();

this.Container.Add(panelke); // this is in a window form



My goal is to make a lots of components, so they can be added when the are
needed



THx

JC
 
Jeroen,

Are these meant to have a visual representation? If so, then you might
want to derive from Control instead of deriving from Component. Objects
derived from Component don't necessarily have a visual representation.

Hope this helps.
 
Yes, i need visual representation

I think you are right about it, i gonna try that!

Thx!
JC
Nicholas Paldino said:
Jeroen,

Are these meant to have a visual representation? If so, then you might
want to derive from Control instead of deriving from Component. Objects
derived from Component don't necessarily have a visual representation.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jeroen Ceuppens said:
Hi,
I want to add a component of these class :

public class OptiePanel : System.ComponentModel.Component

I put on this class in a constructor with in it lost of things to add like:
this.Container.Add(labelHoofd);

So if I want to add an object of this class in the main form, how should I
do it?

Because if I do this it will not work:

OptiePanel panelke=new OptiePanel();

this.Container.Add(panelke); // this is in a window form



My goal is to make a lots of components, so they can be added when the are
needed



THx

JC
 
Back
Top