Good day! I've been creating classes to simplify the coding in my projects, i
was surprised that procedures and functions are not allowed in classes?
howcome? is there alternative ways to implement this? classes are great for
the debugging of codes are contained within the class itself. what is the new
procedure if to place a procedure or function within a class? please help,
thank you and more power...

yong

Re: Procedures and Functions In a Class by Eric

Eric
Mon Oct 25 00:56:56 CDT 2004

Hello, Yong!
You wrote on Sun, 24 Oct 2004 21:27:04 -0700:

YM> Good day! I've been creating classes to simplify the coding in my
YM> projects, i was surprised that procedures and functions are not allowed
YM> in classes? howcome? is there alternative ways to implement this?
YM> classes are great for the debugging of codes are contained within the
YM> class itself. what is the new procedure if to place a procedure or
YM> function within a class? please help, thank you and more power...

Not sure what you mean by "procedures and functions are not allowed in
classes". I think you have some kind of coding errors. Procedures and
functions are allowed and are in fact "methods". Here's a sample class
definition:

DEFINE CLASS sample AS Custom
PROCEDURE Init()
* do something
ENDPROC
PROCEDURE MyCustomMethod(tnSomeParameter As Integer) AS String
RETURN TRANS(tnSomeParameter)
ENDPROC
ENDDEFINE

In the visual class designer, you would go to Class | New Method.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Procedures and Functions In a Class by Anders

Anders
Mon Oct 25 09:34:43 CDT 2004

Hi Yong
In a the Code window it's not possible to write
PROCEDURE x
PROCEDURE y
Endproc
like in a program file or the Database Stored Procedures window.
You have to go to the Class menu (in the Class Designer) or the Form menu
(in the From Designer) and enter a new procedure name in the 'New method.. '
dialog.
When you return to the code window you'll find the name of the new
procedure/function/method at the bottom of the Procedure: dropdown listing.
You'll also find it in the Methods tab of the Property sheet.
After you've filled in some code it will move to the top of the list. On
the Methods tab of the Property Sheet you'll see events and used defined
procedures with code clearly distinguished from empty ones.
-Anders

"Yong Mallare" <YongMallare@discussions.microsoft.com> wrote in message
news:1B848937-E948-4D85-AB79-0782F608D65F@microsoft.com...
> Good day! I've been creating classes to simplify the coding in my
projects, i
> was surprised that procedures and functions are not allowed in classes?
> howcome? is there alternative ways to implement this? classes are great
for
> the debugging of codes are contained within the class itself. what is the
new
> procedure if to place a procedure or function within a class? please help,
> thank you and more power...
>
> yong