Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to store functions
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00453555
Message ID:
00453693
Views:
21
>I've got a form with a date field. This date field needs to be converted to an OLE Date, and I've got a nice little conversion program that does that, which I call as a function. However, as soon as I define a function within a form method and try to close the method I get the following message:
>
>"Methods and Events cannot contain nested procedures or class definitions."
>
>So, I made another method with my conversion function...but then I also found that I have a leapyear function within the conversion function....and before adding another method to the form, I began thinking, maybe this isn't a "best practice".
>
>So, what are my options?
>
>1. I can place the function as .prg file in my source folder for the project
>or
>2. I can define new methods for the form, till the cows come home.
>
>or ???
>

Procedure files are still supported; you can put common UDFs into them and have them searched by SET PROCEDURE TO ... ADDITIVE. I use this to include common UDFs and to define non-visual classes - you can look at CLSHEAP to see examples of using a procedure file to do both things. I have wrappers on various API calls, common data validation and formatting UDFs and the like sitting in procedures as well. As long as you are willing to give up the use of relative object references like THIS, THISFORM etc in your UDFs, using procedures is still permitted.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform