Cminor

Evening all,

My question is can I have an System.Windows.Forms.Application.Run(MainForm) statement and execute it without having parsed MainForm visually appear. I have attempted to set properties such as Visible and methods like Hide() in the Form_Load event to no avail. It still shows the form.

//This is the class where i try and run my mainForm code

Trip_GenericWebBrowser

_newGenericBrowserForm = new Trip_GenericWebBrowser();

_newGenericBrowserForm.Controls.Add(_newBrowser);

_newGenericBrowserForm.Visible =

false;

_newGenericBrowserForm.Hide();

System.Windows.Forms.

Application.Run(_newGenericBrowserForm);

//This is my form code

using

System;

using

System.Collections.Generic;

using

System.ComponentModel;

using

System.Data;

using

System.Drawing;

using

System.Text;

using

System.Windows.Forms;

namespace

TripJobber

{

public partial class Trip_GenericWebBrowser : Form

{

public Trip_GenericWebBrowser()

{

InitializeComponent();

}

private void Trip_GenericWebBrowser_Load(object sender, EventArgs e)

{

this.Visible = false;

this.Hide();

}

}

}

Can anyone tell me why the form is still displaying

Thanks

Martin



Re: Visual C# General Application.Run() without showing the parsed form

Mattias Sjogren

If you don't want to show the form, can't you just call Application.Run() without the argument






Re: Visual C# General Application.Run() without showing the parsed form

Peter Ritchie

If you want to have a WinForms based application that sometimes doesn't display a Form, you should use an ApplicationContext object with Application.Run() instead of a WinForm.