custom controls

I have 2 classes. myTextBox and myLabel. I am trying to implement this: when i drag myTextBox onto a Form I want it to have two labels next to it. i want the textbox to know of these labels and if the position of the textbox changes then the position of the label must change with it. All this must occur at design time in VS. Any ideas  

The problem I am facing right now is that when the textbox is added to the form the Initialize component has the code for the textbox but I also need it to generate a label and the code for it.


Answer this question

custom controls

  • Peter Aspect


    NeverMind I figured it out. It was easier than I was making it out to be. You just create a label when the contructor of the TextBox is called and set the parent of the label to the parent of the textbox.

  • JessicaElise

    and how is the adaptive size for the labels implemented here   i doubt that this will work.  
  • custom controls