Passing parameters

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

How can I process parameters passed to my vb.net? Also, is it possible to
use the desktop shortcut created by setup to pass parameters or do I need to
create my own desktop shortcut?

Thanks

Regards
 
* "John said:
How can I process parameters passed to my vb.net?

This code shows you how to get the passed data:

\\\
Public Sub Main(ByVal astrCmdLineArgs() As String)
Dim i As Integer
For i = 0 To astrCmdLineArgs.Length - 1
Console.WriteLine(astrCmdLineArgs(i))
Next i
End Sub
///

- or -

\\\
Public Sub Main()
Dim i As Integer
For i = 0 To Environment.GetCommandLineArgs().Length - 1
Console.WriteLine(Environment.GetCommandLineArgs(i))
Next i
End Sub
///

Notice that the startup object must be set to 'Sub Main'.
 
Is it possible to pass parameters to the app during production in vs.net for
testing?

Thanks

Regards
 
* "John said:
Is it possible to pass parameters to the app during production in vs.net for
testing?

Yes.

Open the project's properties dialog, choose "Configuration settings" ->
"Debugging" -> "Start options" -> "Command line arguments".
 
Back
Top