Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# version of VFP PEMSTATUS()
Message
 
 
À
19/01/2010 05:25:26
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01444636
Message ID:
01444704
Vues:
38
>>
>>As to why method has to belong to a form. I don't know (can't see) where else this method would belong. That is, I add/create a method in the form that enabled/disables certain buttons. At run time the code in each text box event OnTextChange needs to "know" if this (parent) form class has this method or not. So in the OnTextChanged method I need to determine (at run time) if the form class has this method.
>
>
>Dmitry,
>
>I'm not in a position to give expert advise - but let me give a thought
>
>I do not think the GetPemstatus is the .net way - it belongs to the IDE in development mode
>
>Are your forms based on a common (sub) class. If so, you can add a method to the subclass that does nothing. Each textbox can call the method
>If you need some code in it why not override that method in the forms that need it ?
>
>You can make that more explicit by defining an interface and have your common sub class implement that interface. All the forms can override the method
>
>Depending on what you want to do, you can even add an eventhandler to the form, or add a class/object to the form that is reponsible for that behaviour
>
>The textbox' OnTextChange event can forward that event to that class/object you have added to the common subclass form.

Gregory,

Thank you very much for your input. And I also thought about the approach you bring up: creating a base class of a form with a method that I need. All that you say makes sense. Many choices.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform