|
-
Oct 2nd, 2000, 09:15 PM
#1
In my form_load() I have this code:
...
If Not (Command = "") Then
MakeConnection
End If
...
...
...
End Sub
I do have a MakeConnection sub defined, but when I compile and run the app with a Command, an error comes up saying:
Runtime error '5':
Invalid procedure call or argument.
I've tried replacing the call to the MakeConnection sub with a MsgBox and it works, can I not call the sub like that? If so, could you tell me why not?
-
Oct 2nd, 2000, 09:38 PM
#2
none of you gurus can come up with an answer?
-
Oct 2nd, 2000, 09:47 PM
#3
Try this:
Code:
Private Sub Form_Load()
If Command <> "" Then
MakeConnection
End If
End Sub
-
Oct 2nd, 2000, 09:50 PM
#4
nope, didn't work
Isn't that just another way to write what I already have?
-
Oct 2nd, 2000, 10:16 PM
#5
Fanatic Member
Here's what I tried. I didnt' see where you declared the command variable, so I just did it in the form load area.
Code:
Private Sub Form_Load()
MsgBox Command$
If Not (Command$ = "") Then
MakeConnection
End If
End Sub
Private Sub MakeConnection()
MsgBox "howdy"
End Sub
With no command line switches, I get an empty form. when I use a commandline switch (-woop) , I got the messagebox -woop and howdy. I'm unsure why it doesn't work for you ...
-
Oct 2nd, 2000, 10:39 PM
#6
maybe iif i elaborate
the command line argument is going to be used as an index in an array, so that Command$ variable is guaranteeed to be a number. I don't know if that makes a difference or not
-
Oct 2nd, 2000, 10:43 PM
#7
Fanatic Member
I tested my compiled 'test' project with just a number and it worked fine. Just make sure you convert the string into a number before using it as a number for an array. and also make sure that you have the array Dim'ed to that number or you'll have problems (ReDim Preserve ArrayName (Val(Command$)) ...
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
|