Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Questions/Problems with subclassing controls and forms
Message
 
À
04/08/2010 21:08:44
Information générale
Forum:
ASP.NET
Catégorie:
Programmation orienté objet
Divers
Thread ID:
01475116
Message ID:
01475250
Vues:
46
Hi Bonnie,

thanks a lot für your advice. I changed my code to using an interface, but the problem still occurs.
This is what I do now:

The cmdexit-button-class changed to
        If TypeOf (Me.Parent) Is IDoExit Then
            CType(Me.Parent, IDoExit).DoExit()
            MsgBox("Interface Button")
        Else
            'MsgBox("Methode fehlt")
        End If
        MyBase.OnClick(e)
The Myform-Baseclass-Code is now
Implements IDoExit
...
   Public Overridable Sub DoExit() Implements IDoExit.DoExit
        If Not Me.lIsRunning Then
            MsgBox("Interface Base doexit")
            Me.Close()
        Else
            MsgBox("Interface Isrunning")
        End If
    End Sub
As you mentioned, I forgot to say that all forms are inherited from that myform-baseclass.

Form1 which is the startform, has two buttons, the inherited cmdexit-button which closes the form and another button which
start Form2 as a modal form.
When I click the cmdexit-button on Form1 everything works, i get the "Interface Base doexit"-msgbox and the form closes.

Form 2 has also a cmdexit-button and I expected it to close this form too. But what it does is, that it shows first
the "Interface Base doexit"-msgbox, then the "Interface Button"-msgbox (which does not happen on Form1) but does
not close the form.
So something must be wrong in my inheritance chain.

Best regards

Thomas
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform