This is a small mistake (I'm ready to live in the interests of go-live, to be honest), but I wonder if anyone has any ideas to fix this.
I have a C # WinForms application. When the application is launched through the executable file (not through the debugger), the first thing the user sees is the console window, followed by the main window (after pre-loading it is completed.)
I would not want to display a console window. (As I said, this is a small mistake.)
The project output is already installed in the Windows application.
Here (most) is the code for the Main () method. I cut out various material related to property / security, replacing them with comments where necessary.
[STAThread] static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // SNIP: Get username from Windows, associate with DB user if (user == null || user.UID == 0 || (user.Active.HasValue && !(user.Active.Value))) { MessageBox.Show(ErrorStrings.UnknownUser, ErrorStrings.TitleBar, MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return; } // SNIP: Associate user with employee object Application.Run(new MainForm()); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, UiStrings.ExceptionPolicy)) { string message = ErrorStrings.UnhandledPreface + ex.ToString(); MessageBox.Show(message, ErrorStrings.TitleBar, MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } } }
Does anyone have any ideas?
source share