Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Project components/vfp visual classes
Message
De
13/11/2007 14:46:39
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Project components/vfp visual classes
Divers
Thread ID:
01268726
Message ID:
01268726
Vues:
56
Greetings all
I am attempting to duplicate visual classes in vb.net. Currently, I am creating a class in a name space:
Namespace frwFormObjects
    Public Class clsLblFieldDesc
        Inherits System.Windows.Forms.Label
        Public Sub New()
            Me.ForeColor = Color.CadetBlue
            Me.Font = New Font("Arial", 10, FontStyle.Bold)
        End Sub
    End Class

    Public Class clsTxtBox
        Inherits System.Windows.Forms.TextBox
        Public Sub New()
            Me.ForeColor = Color.CadetBlue
            Me.Font = New Font("Arial", 15, FontStyle.Bold)
        End Sub
    End Class
End Namespace
When the system is rebuilt, the classes show up in the project components tool box. I can drag the component on the form where all the properties come along for the ride. The properties overstay there welcome however, the properties for those objects also show up in the code.
        'txtLastName
        '
        Me.txtLastName.Font = New System.Drawing.Font("Arial", 11.0!, System.Drawing.FontStyle.Bold)
        Me.txtLastName.ForeColor = System.Drawing.Color.CadetBlue
        Me.txtLastName.Location = New System.Drawing.Point(98, 45)
        Me.txtLastName.Name = "txtLastName"
        Me.txtLastName.Size = New System.Drawing.Size(100, 24)
        Me.txtLastName.TabIndex = 3
        '
Therefore, if I change a property in one of the above classes in namespace frwFormObjects, the change does not manifest on existing form objects after the rebuild because the form code overrides the properties of the class. I could delete all the code, but there must be a better way. How can I keep the code out of the form and have existing form objects inherit from the component after dragging the component out on the form.

Thanks, Vince
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform