Switches for My Application

  • Thread starter Thread starter Atley
  • Start date Start date
A

Atley

I want to be able to pass information to my application viw Command Line
Switches.

I want to be able to pass an operator ID to my application from a command
line switch.

I cannot find anyway to do that in Visual Studio .net 2003
 
This will accept the command line args.

Sub Main(CmdArgs() as String)
debug.writeline(CmbArgs(0))
end sub
 
Main() method can accept parameters. For example:

Public Shared Sub Main (args() As String)
{
// args(0) 1st arg; args(1) 2nd arg; etc.
}


I want to be able to pass information to my application viw Command Line
Switches.

I want to be able to pass an operator ID to my application from a command
line switch.

I cannot find anyway to do that in Visual Studio .net 2003
 
Get them damn curly braces out of here! Heresy!

;-)

Chris
 
if i use your method... and tell my application to use



MyAppPathUsed = CurrentApp.AppPath & " " & OperatorID

Dim ProcID as New Process
ProcID.Start (MyAppPathUsed)

to start the application, I get File Not Found Errors


I am getting the application paths from a SQL database, so I have to start
the application dynamically depending on which application they choose.


Can you tell me how I can dynamically add the switch to my application path
in code and start it.
 
Sorry about that! :-(

Here is the correct code, btw:

Public Shared Sub Main (args() As String)
'args(0) 1st arg; args(1) 2nd arg; etc.
End Sub

(Thats what happens when you think in C# and code in VB.NET! :-) )

in message Get them damn curly braces out of here! Heresy!

;-)

Chris
 
Take a look at the startprocessinfo class (Process.StartInfo property).
There are several examples in there. or you can use the overloaded method
of Process.Start

//Not Tested
dim MyAppPathUsed as String
Dim OperatorID as String = "1"

MyAppPathUsed = CurrentApp.AppPath

Dim ProcID as New Process
ProcID.Start (MyAppPathUsed, OperatorID)

Hope it helps.
 
Atley said:
I want to be able to pass information to my application viw Command Line
Switches.

I want to be able to pass an operator ID to my application from a command
line switch.

\\\
Public Module Program
Public Sub Main(ByVal Args() As String)
If Args.Length > 0 Then

' 'Args' is a string array that contains the command line
' parameters' values.
End If
End Sub
End Module
///

In the project properties, select 'Sub Main' as startup object.
 

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

Back
Top