Console Rollback Prevention

Can a VB.NET Windows Forms application be configured so that when it starts from the command line, the command line waits until the application exits before displaying the next prompt?

+4
source share
4 answers

You can change the command to start the application from the command line:

start /wait YourApplication.exe 

In general, the command line behavior depends on the subsystem used by your application (console / Windows). As an application with a subsystem, Windows does not have standard I / O streams; there is no need to wait until the console waits for them.

But you can change your application as a console application and use your existing forms as usual. This link shows an example.

+4
source

Code after Application.Run (new Form1 ()); It starts only after the application exits. No configuration required.

 static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); string s = "test string"; s.Trim(); } 
+1
source

I think the answer is no, but the console application can display forms.

0
source

If the command line is not your console application, then no.

I guess you could create a console application that cropped the windows forms application ... a kind of bootloader. If the console application needs to be run on the command line, this can do the trick.

0
source

Source: https://habr.com/ru/post/1306933/


All Articles