Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass parms to custoom classes?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
How to pass parms to custoom classes?
Divers
Thread ID:
00591313
Message ID:
00591313
Vues:
69
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform