Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass parms to custoom classes?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
How to pass parms to custoom classes?
Miscellaneous
Thread ID:
00591313
Message ID:
00591313
Views:
68
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",,"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
Next
Reply
Map
View

Click here to load this message in the networking platform