By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

User Control inherited from TextBox with Label

P: n/a
I want to create a 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

Oct 31 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.