ah7386
asked on
VB.NET - Subclassing exisiting controls
Hi there,
I am quite new to VB.NET, moving over from Visual Foxpro. In foxpro it was possible to subclass all of the standard windows controls in a class lbrary and then use the subclassed controls to build your forms.
The main benefit is that you can add functionality to the standard controls and adjust there appearance in the subclassed control which would then filter down to the controls throughout your application.
I have built a class library in VB.NET and subclasses all of the controls using the standard...
Public Class myTextBox
Inherits TextBox
End Class
This works fine and I can add the class library dll to the toolbar - great. The only problem is, when I alter a control in the class library (say changing a font for example) - the change isnt reflected in the forms that use the control. In order for this to work I have to remove the controls and add them again!
Am I missing something here? Has anyone any examples of a control library class that I can look at?
I would really appreciate your help as im getting more and more irritated by some of the .NET functionality! (I wont mention transparent controls!!)
Kind Regards
AH
I am quite new to VB.NET, moving over from Visual Foxpro. In foxpro it was possible to subclass all of the standard windows controls in a class lbrary and then use the subclassed controls to build your forms.
The main benefit is that you can add functionality to the standard controls and adjust there appearance in the subclassed control which would then filter down to the controls throughout your application.
I have built a class library in VB.NET and subclasses all of the controls using the standard...
Public Class myTextBox
Inherits TextBox
End Class
This works fine and I can add the class library dll to the toolbar - great. The only problem is, when I alter a control in the class library (say changing a font for example) - the change isnt reflected in the forms that use the control. In order for this to work I have to remove the controls and add them again!
Am I missing something here? Has anyone any examples of a control library class that I can look at?
I would really appreciate your help as im getting more and more irritated by some of the .NET functionality! (I wont mention transparent controls!!)
Kind Regards
AH
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm not sure about that one...The thing I like about creating my own controls is that I can make my own properties and then just set them from the properties window....Sorry
-Tim
-Tim
ASKER
Anyhow - many thanks for your detailed response.
PS - when your altering fonts etc. Which event do you use to put your:
font = new font("Tahoma")
code in? - the NEW or the OnCreateControl event?
Thanks
AH