Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Command line to my app VB.NET 2003 1

Status
Not open for further replies.

DougP

MIS
Joined
Dec 13, 1999
Messages
5,985
Location
US
I had an app I created
TimeCard.EXE

Each use had an icon on their desktop
[red]C:\TimeCard.EXE /E 103 /L CAD[/red]

The Employee number in this case is 103 and the location of his computer is in the CAD dept.

I added this [red]/E 103 /L CAD[/red]
to the VB6 Project properties on the "Make" TAB in the "Command line" so I could create the applicatoon and test it.

I cannot find where to add Command line parameters to VB.NET 2003 so I can convert my app to VB.NET

TIA



DougP, MCP, A+
 
Hi Doug. You have two options

1) Dim sParams() As String = Environment.GetCommandLineArgs
2) Dim sParamString As String = Environment.CommandLine

Take a look in the help, or search these on the net, but this is what you need.

Code:
[Visual Basic] 
' Sample for the Environment.GetCommandLineArgs method
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      '  Invoke this sample with an arbitrary set of command line arguments.
      Dim arguments As [String]() = Environment.GetCommandLineArgs()
      Console.WriteLine("GetCommandLineArgs: {0}", [String].Join(", ", arguments))
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'C:\>GetCommandLineArgs ARBITRARY TEXT
'
'GetCommandLineArgs: GetCommandLineArgs, ARBITRARY, TEXT

Hope this helps.

Gary
 
its a shame VB.net does have vbscript functions

CODE
test.vbs /sLocation:"BRA"
with within the script for sLocation or any other variable to this effect.

CODE
if wscript.arguments.named.exists("sLocation")
sLocation=wscript.arguments.named.item("sLocation")
end if

i use in .net

Dim sep As String = " "
Dim Commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = Commands.Split(sep.ToCharArray)
For Each aArg In Args
........
 
How do you specify the command line arguments when you are debugging VB.NET. I know how to do in C++?

Charlie

Everything I know I learned from The Grateful Dead and Buffy The Vampire Slayer
Charlie
 
In VB.NET Click "Project" menu
then "Your Project" 'Properties' (last item in list)
Then click the "Configuration foldeer on the left
click "Debugging" item in list (on left)
you will see "Start OPtions" (in the middle)
then a box called "Command line Argumnents"
I typed in '103 CAD' in that box

click OK back out.


DougP, MCP, A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top