Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Repeating piece of code
Message
From
02/04/2013 09:14:02
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01569704
Message ID:
01569715
Views:
83
>I know that click method does not allow embedded procedures.
>
>But is there any trick to execute a small piece of code inside the method,
>calling it with Do, or other command ?
>
>It would be very useful because when you write inside a procedure it will not work,
>if inside the procedure there are lines as thisform.command1.click, etc.

I'm not exactly sure what you're asking, but in general the right way to handle a piece of code that you need several places is to create a custom method at the appropriate level and call it where you need it.

So, if you'll need this code in a number of different command buttons, add it as a custom method to your button class. If you'll need it from a number of different places in a single form, add it to the form. If you'll need it in a number places in a number of forms, add it to a form class. If you'll need it throughout your application, add it to your application class.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform