Search code examples
c#winformsc#-4.0visual-studio-2017user-controls

Window Form Control Library that use WebBrowser generate property pane in Windows form


I create a Window Form Control Library and in user control designer I add a web browser component. In control load I add this code:

 private void MyWebBrowserControl_Load(object sender, EventArgs e)
 {
     webBrowser1.Navigate("http://www.google.com");
 }

I add just this user control to tool box of another windows form project but it generate property pane an select user control combo box for the for. I do not know where they came from. enter image description here

and:

enter image description here

How to remove every thing except MyWebBrowser in windows form?

Thanks


Solution

  • Your project is a user control library project. You are running that project in debug mode. As a user control library project cannot actually run as an application it opens the screen you see. This allows you to test the user controls in your project. You select your user controls from the drop down and can change properties from the property grid.

    If you look at your solution explorer you will see that your user control project is listed in Bold text:

    Projects

    This means that the control library is the default project that will run when you press the debug button.

    To change this, right click on your windows forms application project and select Set as StartUp Project from the list.

    Set as start up project

    Your windows forms project will now be shown in Bold text:

    Changed start up

    Now, when you start debugging the solution it will run the Windows Forms Application instead of the User Control Library.