Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Some Help
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00603741
Message ID:
00604890
Vues:
23
>Next question:
>
>Can I subclass a form in VB?


You can't really sub class objects in VB but there are some hacks.

Create this class (named clsForm):
Option Explicit

Public gForm As Form

Public Property Get SubClassedCaption() As Variant
    SubClassedCaption = gForm.Caption
End Property

Public Property Let SubClassedCaption(ByVal vNewValue As Variant)
    gForm.Caption = vNewValue
End Property
Create this form (that contains a command button):
Option Explicit

Private mForm As clsForm

Private Sub Command1_Click()

    Set mForm = New clsForm
    With mForm
        Set .gForm = Me
        .SubClassedCaption = "a sub classed caption"
    End With
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform