Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programatically adding a class to a form
Message
 
To
30/10/2006 07:20:00
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01165430
Message ID:
01165468
Views:
12
If your in the form designer, and have the button on the screen, and double click the form, it should automatically open the code window for the command button "Click". You can NOT have any such "function", or "procedure" defined within that code... Thats what its probably complaining about... Do you have something like...
*/ in the command button
prepare some variables
more prep
..
..
do Something

return

function Something
   now, whatever you were trying to call
   anything else
endfunction
You can't do this inside a code window, you would have to rework how/where the possible "do something" function scenario... if your command button is a custom class, you could create your own new method on that, or have a seperate procedure file with stand-alone type functions.









>Hello Fabio,
>
>Thanks very much for your reply.
>
>But no headway yet. I would like to put code into a commandbutton on a form to instantiate a class. But the commandbutton does not accept the code with the error message "Methods and events cannot contain procedures or class definitions"
>
>Any help will be greatly appreciatiated.
>
>Thanks and regards,
>
>Steve.
Previous
Reply
Map
View

Click here to load this message in the networking platform