Command Line

O

Omar Abid

Hi developer,
I'm writing a command line that accept arguments
So i can use it like ping " Ping adressip "
I mean arguments (adressip)
I used the following method
Module Main
Sub main ( Byval args() as string)
Coding...
End sub
The problem that i can't use a string but an array
so if i replace with the following
Sub main (Byval args as string)
Coding..
End sub
an error occured
Any body have an idea
 
R

rowe_newsgroups

Hi developer,
I'm writing a command line that accept arguments
So i can use it like ping " Ping adressip "
I mean arguments (adressip)
I used the following method
Module Main
Sub main ( Byval args() as string)
Coding...
End sub
The problem that i can't use a string but an array
so if i replace with the following
Sub main (Byval args as string)
Coding..
End sub
an error occured
Any body have an idea

It's an array to allow for multiple parameters seperated by spaces
like "ping -a ipaddress." If you just want a single string just use a
for loop and reconstruct the string from the array.

i.e.

Sub Main(args As String())
Dim param As String = ""
For Each arg As String in args
param &= arg & " "
Next

'// Use param string from now on
End Sub

Thanks,

Seth Rowe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top