|
-
Jan 30th, 2000, 04:04 AM
#1
Thread Starter
New Member
To tell the thruth, I'm almost ashamed to ask such a question, but I haven't have much of a choice...
I want to know how to call a Sub from an object.
I've got no trouble calling on functions, yet when I call on a Sub,
IE : Generator.GenerateVariables(Param1, Param2)
I get an error :" = Excepted"
Does that mean VB believe it isn't a Sub, rather a property ??
I can't figure this out...
-
Jan 30th, 2000, 04:07 AM
#2
Hyperactive Member
Its because the sub you are calling contains (). (make sure inside here is empty).
for example:
Generator.GenerateVariables(Param1, Param2)
should be:
Generator.GenerateVariables()
Don't ask me why
[This message has been edited by rino_2 (edited 01-30-2000).]
-
Jan 30th, 2000, 04:17 AM
#3
why does that happen? even if it isn't supposed to return something it still asks for an = sign. call it like this:
sub num1, num2
instead of
sub(num1,num2)
that should solve your problem
-
Jan 30th, 2000, 04:19 AM
#4
Actually, it's because when you put parenthesies around your Parameters VB expects you to return a Value which it then has to assign, hence it tells you "=" is expected.
2 Ways to avoid this,
1) Use Call, ie. Call Generator.GenerateVariables(Param1, Param2)
or..
2) Remove the Parenthesies, ie. Generator.GenerateVariables Param1, Param2
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|