Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8040447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:53:58+00:00 2026-06-05T03:53:58+00:00

I am trying to load a certain page though WebBrowser control while avoiding unnecessary

  • 0

I am trying to load a certain page though WebBrowser control while avoiding unnecessary advertisement banners which load in DIV element called ‘tb’.

How can I do this? I have done some googling and found an example using mshtml reference but I can’t make it work from this example: https://stackoverflow.com/a/1218875

Any ideas?

Why wouldn’t this work?

using System;
using mshtml;
using System.Windows.Forms;

namespace Client
{
    public partial class Client : Form
    {
        public Client()
        {
            InitializeComponent();

            HTMLDocumentClass htmldoc = wbBrowser.Document.DomDocument as HTMLDocumentClass;
            IHTMLDOMNode node = htmldoc.getElementById("tb") as IHTMLDOMNode;
            node.parentNode.removeChild(node);
        }
    }
}

I get an error:

‘mshtml.HTMLDocumentClass’ does not contain a definition for ‘getElementById’ and no extension method ‘getElementById’ accepting a first argument of type ‘mshtml.HTMLDocumentClass’ could be found (are you missing a using directive or an assembly reference?)

And:

Interop type ‘mshtml.HTMLDocumentClass’ cannot be embedded. Use the applicable interface instead.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:54:00+00:00Added an answer on June 5, 2026 at 3:54 am

    You can do this using:

    IHTMLDocument3 htmldoc = wbCtrl.Document.DomDocument as IHTMLDocument3;
    IHTMLDOMNode node = htmldoc.getElementById("xBar") as IHTMLDOMNode;
    node.parentNode.removeChild(node);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to .load some content which is triggered by clicking an tag with
While trying to load a Bitmap onto a SWFLoader the Event.COMPLETE event is not
Here on page load i am trying to store the values from form to
I'm trying to toggle the visibility of certain DIV elements on a website depending
I am trying to make an extension as part of which i want certain
iam trying to tell the page to open a certain aspx if it exists
I'm trying to make it possible to reach certain tabs in the page by
I am trying to make a layout switcher. A user clicks a certain div
I'm trying to select a element that meets certain criteria. Right now I'm doing
I am trying load a ruby script that uses nokogiri, but get a LoadError

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.