Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass parms to custoom classes?
Message
From
07/12/2001 13:55:33
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00591313
Message ID:
00591340
Views:
24
This message has been marked as the solution to the initial question of the thread.
Rodd,

I think it's the 3rd parameter in the newobject call...pass it the empty string (see below)


>I'm new to the whole visual realm so this may be a rather stupid question; however, its enough to give me a headache.
>
>I'm trying to create a custom class. I want to be able to pass a parameter to it as it's being initialized. I've done the following but I keep getting the error: Function argument value, type, or count invalid.
>
>(Using VFP 7)
>
>***** Class definition in c:\temp\test.prg
>define class TstClass as custom
> protected tstValue
>
> function Init(cType as string)
> = messagebox(cType)
> this.tstValue = cType
> endfunc
>enddefine
>
>
>***** command line code
>oTest = newobject("TstClass","c:\temp\test.prg",<b>''</b>,"Value")
>
>Running the above line is when I get my error. The error message hits before the messagebox ever displays. I've even removed the messagebox just to make sure that the error wasn't happening there.
>
>From everything I've read, that should be right. Am I forgetting something? Can you not pass parameters to the Init function? (Everything I've read says you can.)
>
>Thanks for whatever help you can offer!
>
>Rodd
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform