|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to recognize a Command Line parameter?I am trying to send a command line parameter to a utilty I wrote. For
example: c:\utilities\powerbuddy.exe 50 The 50 can be any number. How do I see it in the program? Do I have to create a Main rountine and pass it the value? If so how? And then, how do I load the main form of the applicaiton from the Main sub? Thanx, "Anil Gupte" <anil-l***@icinema.com> schrieb: <URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/95ee4737bce72df5>>I am trying to send a command line parameter to a utilty I wrote. For >example: > > c:\utilities\powerbuddy.exe 50 > > The 50 can be any number. > > How do I see it in the program? Do I have to create a Main rountine and > pass it the value? If so how? And then, how do I load the main form of > the applicaiton from the Main sub? Loading the form: \\\ Application.Run(New MainForm()) /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> I am getting No accessible 'Main' method with an appropriate signature was
found in 'PowerBuddy'. Where do I put this: Public Module Program Public Sub Main(ByVal Arg As Integer) End Sub End Module I right clicked on the solution and picked "Add Module". Then I added the Sub Main and made the module Public. Still I am getting the abvoe error. Thanx, Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:uS2Rk24EHHA.3616@TK2MSFTNGP02.phx.gbl... > "Anil Gupte" <anil-l***@icinema.com> schrieb: >>I am trying to send a command line parameter to a utilty I wrote. For >>example: >> >> c:\utilities\powerbuddy.exe 50 >> >> The 50 can be any number. >> >> How do I see it in the program? Do I have to create a Main rountine and >> pass it the value? If so how? And then, how do I load the main form of >> the applicaiton from the Main sub? > > <URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/95ee4737bce72df5> > > Loading the form: > > \\\ > Application.Run(New MainForm()) > /// > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> "Anil Gupte" <anil-l***@icinema.com> schrieb: The 'Main' sub expects an array of strings as shown in my sample. You'll >I am getting No accessible 'Main' method with an appropriate signature was >found in 'PowerBuddy'. > > Where do I put this: > Public Module Program > > Public Sub Main(ByVal Arg As Integer) have to perform your own conversion: \\\ Public Sub Main(ByVal Args() As String) Dim Number As Integer If Args.Length > 0 Then Number = CInt(Args(0)) Else ... End If End Sub /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Anil,
An easy way is to use VB's Command function. No need to go the Sub Main, etc route just to get the command line args. If your program currently starts with a startup form, just use the Command functionfrom code on the form. Kerry Moorman Show quoteHide quote "Anil Gupte" wrote: > I am trying to send a command line parameter to a utilty I wrote. For > example: > > c:\utilities\powerbuddy.exe 50 > > The 50 can be any number. > > How do I see it in the program? Do I have to create a Main rountine and > pass it the value? If so how? And then, how do I load the main form of the > applicaiton from the Main sub? > > Thanx, > -- > Anil Gupte > www.keeninc.net > www.icinema.com > > > you can do this in several ways
In VB < .Net there was Command$ and it is in VB.Net Command() Orelse (only VB.Net 2005 :-) ) My.Application.CommandLineArgs regards Michel Posseth Show quoteHide quote "Anil Gupte" wrote: > I am trying to send a command line parameter to a utilty I wrote. For > example: > > c:\utilities\powerbuddy.exe 50 > > The 50 can be any number. > > How do I see it in the program? Do I have to create a Main rountine and > pass it the value? If so how? And then, how do I load the main form of the > applicaiton from the Main sub? > > Thanx, > -- > Anil Gupte > www.keeninc.net > www.icinema.com > > >
Read and write database
Help - Timing Logic Serial ports. Attaching multiple files of any type to a mail message? [OT] VB.Net and MS Access communicate with Activesync? Can it be done? Need pre-built report administration application Adding Dropdownlist to GridView Help writer? Where is the VS mru list file stored? |
|||||||||||||||||||||||