[VB.NET] Custom Control And Heritage

Fruity

Member
Joined
Sep 28, 2004
Messages
6
Programming Experience
1-3
Hello,
I develop the controls personalized in dot.net, more precisely in vb.net

I have to develop a textbox, a label, a button, plus some others

For each one of them my class inherits the basic class control to create

For the TextBox

Code:
Namespace WebControls

'''<summary>Classe de gestion des contrôles "TextBox" sécurisés</summary>
Public Class TextBox
Inherits System.Web.UI.WebControls.TextBox
Implements System.Web.UI.INamingContainer

For the Label

Code:
'''<summary>Classe de gestion des contrôles "Label" sécurisés</summary>
Public Class Label
Inherits System.Web.UI.WebControls.Label
Implements System.Web.UI.INamingContainer

For the Button

Code:
'''<summary>Classe de gestion des contrôles "Button" sécurisés</summary>
Public Class Button
Inherits System.Web.UI.WebControls.Button
Implements System.Web.UI.INamingContainer

etc

Each one of them is in a space of name WebControls

They have all of the properties (and fields) common:

Code:
Private _sLibelleFonction As String
Private _sGuidFonction As String
Private _xmlValeursSelect As Xml.XmlDocument
Private _bPanelNotNull As Boolean = False
Private _arValeursPossibles As Array

And of the common functions

I know that in dot.net the multiple heritage of classes is not possible
A solution would have been to create a WebControl class with these properties and functions common in the space of name WebControls

Code:
'''<summary>Classe de gestion des contrôles "WebControl" sécurisés</summary>
Public Class WebControl
Inherits System.Web.UI.WebControls.WebControl
Implements System.Web.UI.INamingContainer

And in this case, my personalized controls inherit this WebControl class
But the problem it is that I do not have any more the clean properties of TextBox, the Label, the Button
I am obliged to redefine them
Or to have a property Control TextBox and to add it to my basic control, but this solution is not interesting

I seek a solution to have all his common properties and functions in the same class, while inheriting the basic class which interest me in knowing, TextBox, Button, Label, etc

Thank for your suggestions
 
Top Bottom