Sending command line arg to GUI

  • Thread starter Thread starter KC
  • Start date Start date
K

KC

How can I pass command line arguments to an app that has a regular windows
form as an interface? I know I need a 'Sub Main' method, but then do I have
to run my real 'main' form as an instance in the Sub Main?
 
KC said:
How can I pass command line arguments to an app that has a regular windows
form as an interface? I know I need a 'Sub Main' method, but then do I
have
to run my real 'main' form as an instance in the Sub Main?

\\\
Public Module Program
Public Sub Main(ByVal Args() As String)
...
Application.Run(New MainForm())
End Sub
End Module
///

Select 'Sub Main' as startup object in the project properties.
 
KC said:
How can I pass command line arguments to an app that has a regular windows
form as an interface? I know I need a 'Sub Main' method, but then do I have
to run my real 'main' form as an instance in the Sub Main?

Yes.

Public Sub Main(ByVal args() As String)
Dim frm As New Form1
Application.Run(frm)
End Sub


hope that helps..
Imran.
 
Back
Top