Z
Zeno Lee
What is the best way to return an exit code from a VB.NET windows forms app?
My Forms application is dual purpose. It is an interactive windows app. It
is also automated and run via a script and it needs to return an exit code
to that script.
I've tried a few ways to return an exit code.
1. As a forms app with Entry point being Form1, I've tried
Application.Exit(999). It does not return the exit code.
2. As a forms app with
Shared Sub Main() As Integer
Application.Run(New Form1)
Return 999
End Sub
This does not return the exit code.
3. I changed the app type to console and shared sub main() as integer.
This returns an exit code. However, when run interactively, there's always
a console window running at the same time as the form, which is annoying.
In C# a windows forms app actually returns an exit code.
[STAThread]
static void Main()
{
Application.Run(new Login());
return 999;
}
How can I make a VB.NET windows form app that returns an exit code?
My Forms application is dual purpose. It is an interactive windows app. It
is also automated and run via a script and it needs to return an exit code
to that script.
I've tried a few ways to return an exit code.
1. As a forms app with Entry point being Form1, I've tried
Application.Exit(999). It does not return the exit code.
2. As a forms app with
Shared Sub Main() As Integer
Application.Run(New Form1)
Return 999
End Sub
This does not return the exit code.
3. I changed the app type to console and shared sub main() as integer.
This returns an exit code. However, when run interactively, there's always
a console window running at the same time as the form, which is annoying.
In C# a windows forms app actually returns an exit code.
[STAThread]
static void Main()
{
Application.Run(new Login());
return 999;
}
How can I make a VB.NET windows form app that returns an exit code?