Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>>I have a procedure that is used in most forms that I have in my TblClass.vcx. I drag and drop TblClass onto the form then use the procedures in there. I just had the thought that it would be easier to just add a Method to my form base class for IsEmpty(). That way it is always there when I need it. Is there any reason not to have several procedures added to your form class to handle routine things?
>>
>>Basicly IsEmpty() just checks the control.value to see if it is empty(). if it is empty it puts up a messagebox and returns the focus to that control. I use it in my cmdSave control...
>>
>
>If it's a common method for all your Forms, it makes sense to add it as a custom method to your base form class; you don't have to use it if you don't want to, but it's there and accessible. This now lets you delegate responsibility to the form for the method; anything that needs it like your cmdSave can reference the Form property, as could any other control or method of the form that might need it. If some sort of specialized behavior unique to a Form modifies the behavior, you can add instance code to the method and access it in the same way as other references to the method are made - the controls that rely on it don't need to be aware of the change.
Thanks Ed,
Mostly I was doing things like generating new keys and some repetitive things that are most likly used on every form.... I don't know why but I had created a class to handle that and now I don't have to add that class to my form and the name isn't changed (like when you add an object to a form it becomes Mynewobj1) so I don't make the mistake of forgetting to drop the 1 from the name...
I have seen the light at the end of the tunnel and it's a definite maybe that it's the end of the tunnel and not the train a comming...
THanks for the reply
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement