adding a component

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeroen Ceuppens

    #1

    adding a component

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

    public class OptiePanel : System.Componen tModel.Componen t

    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










  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: adding a component

    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]
    - mvp@spam.guard. caspershouse.co m

    "Jeroen Ceuppens" <jeroen.ceuppen s@barco.com> wrote in message
    news:%23eYmjmEu DHA.1788@tk2msf tngp13.phx.gbl. ..[color=blue]
    > Hi,
    > I want to add a component of these class :
    >
    > public class OptiePanel : System.Componen tModel.Componen t
    >
    > I put on this class in a constructor with in it lost of things to add[/color]
    like:[color=blue]
    > 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
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >[/color]


    Comment

    • Jeroen Ceuppens

      #3
      Re: adding a component

      Yes, i need visual representation

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

      Thx!
      JC
      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> schreef
      in bericht news:%23vWSktEu DHA.2360@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      > Jeroen,
      >
      > Are these meant to have a visual representation? If so, then you[/color]
      might[color=blue]
      > 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]
      > - mvp@spam.guard. caspershouse.co m
      >
      > "Jeroen Ceuppens" <jeroen.ceuppen s@barco.com> wrote in message
      > news:%23eYmjmEu DHA.1788@tk2msf tngp13.phx.gbl. ..[color=green]
      > > Hi,
      > > I want to add a component of these class :
      > >
      > > public class OptiePanel : System.Componen tModel.Componen t
      > >
      > > I put on this class in a constructor with in it lost of things to add[/color]
      > like:[color=green]
      > > this.Container. Add(labelHoofd) ;
      > >
      > > So if I want to add an object of this class in the main form, how should[/color][/color]
      I[color=blue][color=green]
      > > 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[/color][/color]
      are[color=blue][color=green]
      > > needed
      > >
      > >
      > >
      > > THx
      > >
      > > JC
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...