Sending command line arg to GUI

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?
 
H

Herfried K. Wagner [MVP]

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.
 
I

Imran Koradia

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top