Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Form Object Reference as Parameter
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00850454
Message ID:
00850469
Vues:
21
Hi Terry,

You can pass the instance of Form1 to Form2 in the constructor. Use the Baseform class as the type to pass to Form2. This technique allows you to write more generic code that works with families of objects, making use of object-oriented polymorphism rather than coding to a specific class. All methods marked as virtual (C#) or Overridable (VB.NET) will have the methods called in the specific class and not the base class.


>How can I pass an object reference to form1, from form1 to a model form2 so I can make callbacks to form1 in order to set properties in the calling form?
>
>Form1 one is derived from a parent class Baseform that contains the properties that are subsequently set in form1 and changed in form2 via a call back.
>
>Form2 is a generic form that will be called from many forms that are derived from Baseform so I can’t be specific on the type for the parameter in the constructor of Form2.
>
>Thanks in advance
>
>
>Terry Carroll
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform