|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Command line argument in NETHello, in VB6, I could pass a parameter from VB Script to the program
and retrieve the argument using Command(). Please let me know if there is an equivalent method in .NET. Thank you in advance for any assistance. hien_tran,
The Command function is still available in VB.Net. Here is an example that retrieves the arguments and adds them to a listbox: Dim myCommandString As String = Microsoft.VisualBasic.Command Dim myArgs() As String = myCommandString.Split(" "c) For Each arg As String In myArgs ListBox1.Items.Add(arg) Next Kerry Moorman Show quoteHide quote "hien_t***@ghc-hmo.com" wrote: > Hello, in VB6, I could pass a parameter from VB Script to the program > and retrieve the argument using Command(). Please let me know if there > is an equivalent method in .NET. Thank you in advance for any > assistance. > > Command() still works.
You can also use the args() parameter of main which will return the commandline 'pre-split' into arguments e.g. public shared sub main(args() as string) end sub hth, Alan. <hien_t***@ghc-hmo.com> schrieb:
> Hello, in VB6, I could pass a parameter from VB Script to the program \\\> and retrieve the argument using Command(). Please let me know if there > is an equivalent method in .NET. Public Module Program Public Function Main(ByVal Args() As String) As Integer For Each Arg As String In Args MsgBox(Arg) Next Arg Application.Run(...) End Function End Module /// Select 'Sub Main' as startup object in the project properties. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||