win ap with arguments

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi EveryBody:

How can I make windows application project start with arguments and return a
variable.

Thanks for your help
 
Thanks Herfried:

this is now what I got to solve...


I have a windows application which is myApp.EXE starting as
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
....
end
also have a paint method
Private Sub me_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
'must have Imports System.Drawing.Drawing2D
Dim Canvas As Graphics = e.Graphics
...lots of code
end sub


I need to call myApp.exe from another.exe and
pass arguments and receive a return value...
what changes do I need to make to myApp.exe.

Thanks
 
raulavi said:
this is now what I got to solve...


I have a windows application which is myApp.EXE starting as
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
....
end
also have a paint method
Private Sub me_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
'must have Imports System.Drawing.Drawing2D
Dim Canvas As Graphics = e.Graphics
...lots of code
end sub


I need to call myApp.exe from another.exe and
pass arguments and receive a return value...
what changes do I need to make to myApp.exe.

Add a new module to the project:

\\\
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(New MainForm())
If...Then
Return 1
Else
Return 2
...
End If
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
 
Thanks.

Herfried K. Wagner said:
Add a new module to the project:

\\\
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(New MainForm())
If...Then
Return 1
Else
Return 2
...
End If
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
 

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

Back
Top