Loading GeckoWebBrowser Exceptions

Posted by Mostafa Mahdieh on Stack Overflow See other posts from Stack Overflow or by Mostafa Mahdieh
Published on 2010-05-08T19:45:58Z Indexed on 2010/05/08 19:48 UTC
Read the original article Hit count: 1105

Filed under:
|
|

I get a strange exception when a window containing a GeckoWebBrowser is loaded. This is the exception message:

An unhandled exception of type System.Runtime.InteropServices.COMException occurred in Skybound.Gecko.dll Additional information: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

This is the windows code:

public partial class AddContents : Form
{
    String path;

    public AddContents(String path)
    {
        this.path = path;
        InitializeComponent();
    }

    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    {
        this.Close();
    }

    private void AddContents_Load(object sender, EventArgs e)
    {
        geckoWebBrowser1.Navigate(path);
    }

    private int selId = 1;

    private bool updateMode = false;

    private void timer1_Tick(object sender, EventArgs e)
    {
        if (updateMode)
            update();
    }

    private void geckoWebBrowser1_DocumentCompleted(object sender, EventArgs e)
    {
        timer1.Enabled = true;
        updateMode = true;
    }

    private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
    {
        geckoWebBrowser1.Navigate("javascript:scrollToBookmark(" + treeView1.SelectedNode.Tag + ")");
        TreeNode selected = treeView1.SelectedNode;
        TreeNode prev = selected.PrevNode;
        TreeNode next = selected.PrevNode;
        if (prev == null)
            upButton.Enabled = false;
        if (next == null)
            downButton.Enabled = false;
    }

    private void update()
    {
        geckoWebBrowser1.Navigate("javascript:updateSelText()");            
        GeckoElement el = geckoWebBrowser1.Document.GetElementById("sel_result_991231");
        if (el != null) {
            textBox1.Text = el.InnerHtml;
            addButton.Enabled = !textBox1.Text.Trim().Equals(String.Empty);
        }
    }

    private void textBox1_Enter(object sender, EventArgs e)
    {
        updateMode = false;
    }

    private void geckoWebBrowser1_DomMouseDown(object sender, GeckoDomMouseEventArgs e)
    {
        updateMode = true;
        update();
    }

    private void geckoWebBrowser1_DomMouseUp(object sender, GeckoDomMouseEventArgs e)
    {
        updateMode = false;
    }

    private void addButton_Click(object sender, EventArgs e)
    {
        geckoWebBrowser1.Navigate("javascript:addIdToSel()");
        TreeNode t = new TreeNode(textBox1.Text);
        t.Tag = selId;
        treeView1.Nodes.Add(t);
        selId++;
    }
}

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#