Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#122010 - 20/10/2002 15:07 I am so pissed at Microsoft and VB right now.
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
For the last hour I have been struggling with VB6 and a really irritating problem that I think is a bug in their IDE or something.

I'm trying to get AnnaVU saving into the logo editor.

I have a function called "SaveBinFile" that takes one parameter: The path and file name to save.

Looks like this:

Sub SaveBinFile(PathAndFileName As String)

I want to extend this and add another parameter to handle saving AnnaVu files:

Sub SaveBinFile(PathAndFileName As String, Optional AnnaVu As String)

This is all fine. Since the argument is optional, the original calls to this function still work. But when I try to call the function with two parameters, there is a syntax error. The IDE tells me there's a second parameter there just fine in the quickinfo, but it won't let me add it.

Even If I make the second parameter non-optional...

Sub SaveBinFile(PathAndFileName As String, AnnaVu As String)

Same problem. The IDE won't let me enter any call to this function with two parameters. The IDE thinks that one parameter is good, and two parameters is evil. Screen shots:



AAAARGH!!!!


Attachments
120374-kill_me_now.gif (81 downloads)

_________________________
Tony Fabris

Top
#122011 - 20/10/2002 15:24 Re: I am so pissed at Microsoft and VB right now. [Re: tfabris]
AndrewT
old hand

Registered: 16/02/2002
Posts: 867
Loc: Oxford, UK
I seem to remember experiencing something similar, I _think_ I got around it by declaring the 2nd argument as type Variant, YMMV.

Top
#122012 - 20/10/2002 15:51 Re: I am so pissed at Microsoft and VB right now. [Re: tfabris]
ninti
old hand

Registered: 28/12/2001
Posts: 868
Loc: Los Angeles
Try getting rid of the parens when calling it, i.e.
SaveBinFile param1, param2
_________________________
Ninti - MK IIa 60GB Smoke, 30GB, 10GB

Top
#122013 - 20/10/2002 15:57 Re: I am so pissed at Microsoft and VB right now. [Re: tfabris]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Looks like a case of VB letting you get away with murder and then having an unhelpful error message.

If you take the parenthesis off the problem will go away. If VB wasn't quite so lax about letting you call Subs with parenthesis then you would never have hit the problem.

Prefixing the call with "Call" will also fix it.


Edited by andy (20/10/2002 16:02)
_________________________
Remind me to change my signature to something more interesting someday

Top
#122014 - 20/10/2002 16:51 Re: I am so pissed at Microsoft and VB right now. [Re: andy]
number6
old hand

Registered: 30/04/2001
Posts: 745
Loc: In The Village or sometimes: A...
I've struck this problem too. The cause is not obvious, the solution is.

In VB if you put brackets around a variable/parameter, it tells VB to convert the parameter to a string. Using the same syntax to the call a procedure, confuses VB, so it assumes that as its a procedure, it never returns any value, so brackets are not required so you must mean you want to convert the parameter to a string first.
So stating:
myproc(param1)
is different from:
myproc param1
or
call myproc (param1)

What VB is complaining about in your original situation was that you appeared to be trying to concatentate two parameters/variables into a single string.
e.g myproc (param1,param2)
Is seen by VB (wrongly) as (param1,param2) i.e. convert param1 & param2 into a combined string via () then call myproc with one argument.

So, as per Andy's comments, sticking a call in front, or removing the brackets will fix the problem.

The above explanation is why it fixes the problem.




Top
#122015 - 20/10/2002 19:08 Re: I am so pissed at Microsoft and VB right now. [Re: number6]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
Thanks, all three of you who supplied the information about the parens. I will do that. I'm sure it will work.

I love this BBS.
_________________________
Tony Fabris

Top