Bahae-Eddine
Bahae-Eddine

Reputation: 23

Failed to load toolbox item 'ChromiumWebBrowser'

I am making a C# Form application as a web browser, and i want to use CefSharp.

I have a problem loading CefSharp item from toolbox, i have installed the package from Nuget, changed my Platform CPU to x64, but even that nothing is helping to load the control to my form, as you can see in my screenshot.

Anytime I try to drag it to the form I get this error:

Failed to load toolbox item "ChromiumWebBrowser" . It will be removed from the toolbox.

enter image description here

Upvotes: 2

Views: 2413

Answers (1)

Manoj Choudhari
Manoj Choudhari

Reputation: 5634

Instead of dragging and dropping that control, use a method like below to add it to the controls collection.

    private void InitializeChromium()
    {
        CefSettings settings = new CefSettings();

        // Initizlie cef with provided settins. 
        Cef.Initialize(settings);

        chromeBrowser = new ChromiumWebBrowser("http://www.google.com");
        this.Controls.Add(chromeBrowser);
        chromeBrowser.Dock = DockStyle.Fill;
    }

Then call this method from the form constructor:

    public Form1()
    {
        InitializeComponent();    /// Default method of winforms
        InitializeChromium();     /// Our method to load CefBrowser.
    }

Upvotes: 0

Related Questions