-
How can I pass data to a vb executable on the command line?
I need to pass a parameter to a vb executable such as:
MyVBProg.exe '\Temp\Test.txt'
How do I get the data in my vb program? I thought I could just define an
input parameter in my sub line like this:
Sub Main(chFullFileName As String)
FileCopy "C:" & chFullFileName, "D:" & chFullFileName
End Sub
However, this results in the error "Must have startup form or sub". I've
defined Sub Main as the startup object in the project properties.
-
Re: How can I pass data to a vb executable on the command line?
On 10 Dec 2000 13:11:19 -0800, "Bob" <bobharkness@uswest.net> wrote:
>
>I need to pass a parameter to a vb executable such as:
>
>MyVBProg.exe '\Temp\Test.txt'
>
>How do I get the data in my vb program? I thought I could just define an
>input parameter in my sub line like this:
>
>Sub Main(chFullFileName As String)
> FileCopy "C:" & chFullFileName, "D:" & chFullFileName
>End Sub
>
>However, this results in the error "Must have startup form or sub". I've
>defined Sub Main as the startup object in the project properties.
>
Sub Main() is left alone. What you use instead is the VB command
'Command', which will give you the string argument which was used to
launch the application. From there you can parse it out or do
whatever you need to do with it.
Hope this helps,
Ron
-
Re: How can I pass data to a vb executable on the command line?
rphillips71@hotmail.com (Ron Phillips) wrote:
>On 10 Dec 2000 13:11:19 -0800, "Bob" <bobharkness@uswest.net> wrote:
>
>>
>>I need to pass a parameter to a vb executable such as:
>>
>>MyVBProg.exe '\Temp\Test.txt'
>>
>>How do I get the data in my vb program? I thought I could just define
an
>>input parameter in my sub line like this:
>>
>>Sub Main(chFullFileName As String)
>> FileCopy "C:" & chFullFileName, "D:" & chFullFileName
>>End Sub
>>
>>However, this results in the error "Must have startup form or sub". I've
>>defined Sub Main as the startup object in the project properties.
>>
>
>Sub Main() is left alone. What you use instead is the VB command
>'Command', which will give you the string argument which was used to
>launch the application. From there you can parse it out or do
>whatever you need to do with it.
>
>Hope this helps,
>Ron
>
Ron,
Thanks for the help that works great!
Bob
-
Re: How can I pass data to a vb executable on the command line?
Sub Main()
' Command$ contain the parameters of command line
Debug.Print Command$
End Sub
--
Fernando Robles,
From Seville - Spain.
"Bob" <bobharkness@uswest.net> escribió en el mensaje
news:3a33f177$1@news.devx.com...
>
> I need to pass a parameter to a vb executable such as:
>
> MyVBProg.exe '\Temp\Test.txt'
>
> How do I get the data in my vb program? I thought I could just define an
> input parameter in my sub line like this:
>
> Sub Main(chFullFileName As String)
> FileCopy "C:" & chFullFileName, "D:" & chFullFileName
> End Sub
>
> However, this results in the error "Must have startup form or sub". I've
> defined Sub Main as the startup object in the project properties.
>
-
Re: How can I pass data to a vb executable on the command line?
Note the definition of Sub Main.
It does not have any parameters... In order for VB to
identify Sub Main correctly it must be created as a
parameter-less Sub-routine.
Changing the definition to include parameters makes it invalid
for use as the Sub Main() startup sub.
Thanks,
D.
"Fer de John" <fernando@eintec2000.com> wrote:
>Sub Main()
> ' Command$ contain the parameters of command line
> Debug.Print Command$
>End Sub
>
>--
>Fernando Robles,
>From Seville - Spain.
>
>
>"Bob" <bobharkness@uswest.net> escribió en el mensaje
>news:3a33f177$1@news.devx.com...
>>
>> I need to pass a parameter to a vb executable such as:
>>
>> MyVBProg.exe '\Temp\Test.txt'
>>
>> How do I get the data in my vb program? I thought I could just define
an
>> input parameter in my sub line like this:
>>
>> Sub Main(chFullFileName As String)
>> FileCopy "C:" & chFullFileName, "D:" & chFullFileName
>> End Sub
>>
>> However, this results in the error "Must have startup form or sub". I've
>> defined Sub Main as the startup object in the project properties.
>>
>
>
-
Re: How can I pass data to a vb executable on the command line?
Fernando did not modify the definition of Sub Main. He used the Command function
to get the command line parameters.
--Kenny
"dnagel" <dnagel@egghead.com> wrote:
>
>Note the definition of Sub Main.
>
>It does not have any parameters... In order for VB to
>identify Sub Main correctly it must be created as a
>parameter-less Sub-routine.
>
>Changing the definition to include parameters makes it invalid
>for use as the Sub Main() startup sub.
>
>Thanks,
>
>D.
>
>
>"Fer de John" <fernando@eintec2000.com> wrote:
>>Sub Main()
>> ' Command$ contain the parameters of command line
>> Debug.Print Command$
>>End Sub
>>
>>--
>>Fernando Robles,
>>From Seville - Spain.
>>
>>
>>"Bob" <bobharkness@uswest.net> escribió en el mensaje
>>news:3a33f177$1@news.devx.com...
>>>
>>> I need to pass a parameter to a vb executable such as:
>>>
>>> MyVBProg.exe '\Temp\Test.txt'
>>>
>>> How do I get the data in my vb program? I thought I could just define
>an
>>> input parameter in my sub line like this:
>>>
>>> Sub Main(chFullFileName As String)
>>> FileCopy "C:" & chFullFileName, "D:" & chFullFileName
>>> End Sub
>>>
>>> However, this results in the error "Must have startup form or sub".
I've
>>> defined Sub Main as the startup object in the project properties.
>>>
>>
>>
>
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks