Creating a user control inherited from textbox with a label...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I want to create an user control inherited from a TextBox with an
associated label (let's call it a LabelTextBox). The trick is that I
want the control to inherit from TextBox and have all of its properties
available rather than the default properties of the user control. I
also do not want to have to expose the Textbox properties one by one in
a user control.

I have already previously created this control using Delphi and I have
gotten pretty far along with it using VB.Net. Basically, whenever the
"LabelCaption" property is set, a label is either created on the same
parent as the TextBox and the label caption is set or if the label has
already been created, the label caption is simply reset.

Now the hard part. In Delphi, I overrode (and then inherited from) the
setbounds procedure and there I added a call to my UpdateLabel
procedure which forces the label keep its position relative to the
Textbox whenever it is moved. So, at designtime, whenever the TextBox
is moved, the label follows.

I have not been able to do the equivilent with VB.Net as I cannot
figure out how to override setbounds and/or inherit from it too. My
label always stays whereever it was created unless I change the caption
(which also includes a call to UpdateLabel).

Any help with this would be greatly appreciated!

Thanks,

Mark

.



Relevant Pages

  • User Control inherited from TextBox with Label
    ... want the control to inherit from TextBox and have all of its properties ... available rather than the default properties of the user control. ... "LabelCaption" property is set, a label is either created on the same ... figure out how to override setbounds and/or inherit from it too. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Getting Started with Web User Control
    ... > | Subject: Re: Getting Started with Web User Control ... > |> an instance of MyControl and a label ... > |> is in the user control's textbox. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: UserControl Design Mode
    ... Is there any way during design mode via the VS.Net Designer, ... > allow the developer using the designer access to that label or textbox of ... Ie. click on the user control but directly where the label ...
    (microsoft.public.dotnet.framework.windowsforms)
  • User Control binding
    ... Hi, i´ve created a user control that contains a TextBox and a Label, lets ... call this control CText. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • User Control binding
    ... Hi, i´ve created a user control that contains a TextBox and a Label, lets ... call this control CText. ...
    (microsoft.public.dotnet.framework.windowsforms)