Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compile error: Expecte function or variable
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00394670
Message ID:
00394868
Vues:
11
>Hi Roi,
>WAG, but you are assigning the results of oApp.Test to lReturn but you aren't defining return type of Test.

I guess not. I don't really want a return value. I only added that because I kept getting a "Compile Error: Expected: =", so I assumed that was it. All I'm trying to do is add a method to a class that does something and doesn't return anything. I added the method through the class designer.

>Functions are handled differently in VB. There is no Return somevalue at the end of a function. You define a function is this way:
>
Public Function test(arg1 As String, arg2 As String) as Boolean
>    Debug.Print arg1
>    Debug.Print arg2
>    test = True
>End Function
>You assign the value to the function itself. If you don't want a return value then don't assign it to anything; just call it (e.g. oApp.Test("test1","test2").

Ok I see how that works. Thanks.

>Also, I believe (although I'm not sure about this) that Subs and Functions are different in VB. While they are exactly the same in VFP, the old rule of thumb that functions return values and subs (procedures) don't is enforced in VB.

I'm not at a machine with VB right now. I'll see if I can get it to work this afternoon. Thanks for the help.
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform