Public Sub Main(ByVal args() As String)
'do stuff
End Sub
Well, for the (or rather my) record, here's how you do it in a winforms app:
Dim args() As String = Environment.GetCommandLineArgs()
C#, .Net, MVC, jQuery, JavaScript, HTML, CSS, Umbraco, Phonegap / Cordova, Xamarin, iPhone, iOS, Swift, Android, Windows, apps, websites, Full Stack, ecommerce, Facebook, responsive, front-end. Freelance developer, programmer for web and mobile in Bristol, UK.
Public Sub Main(ByVal args() As String)
'do stuff
End Sub
Dim args() As String = Environment.GetCommandLineArgs()
You can still do it the first way, just change your Main method signature from static void Main() to static void Main(string[] args) (this is in C#, similar for VB I assume)
ReplyDeleteThen you can pass the arguments or whatever specific arguments you need onto your form.
But your second way seems like a handy shortcut, thanks.
Thanks Rod, more specifically I guess I'm referring to windows forms apps where the startup object is a form rather a Sub Main procedure.
ReplyDeleteAFAIK Environment.GetCommandLineArgs() can be called at any point or form throughout your process and will return the commandline arguments that were supplied at startup, which makes it doubly handy :)
STARREd and FAVORITEd, thanks for the note.
ReplyDeleteI just dealt with this tidbit as well!
Jose - cadkicks.com