i want to cast this two typs

HtmlDocument doc = Webbrowser.Document;
HTMLObjectElement FirstElm = doc.All[0];

how can i do it

Like this:

HtmlDocument doc = (Webbrowser.Document as HtmlDocument);
        HTMLObjectElement FirstElm = (doc.All[0] as HTMLObjectElement);

Or:

HtmlDocument doc = (HtmlDocument)Webbrowser.Document;
        HTMLObjectElement FirstElm = (HTMLObjectElement)doc.All[0];

Like this:

HtmlDocument doc = (Webbrowser.Document as HtmlDocument);
        HTMLObjectElement FirstElm = (doc.All[0] as HTMLObjectElement);

Or:

HtmlDocument doc = (HtmlDocument)Webbrowser.Document;
        HTMLObjectElement FirstElm = (HTMLObjectElement)doc.All[0];

hi thanks for reply i tried and this is what i get
"Error 1 Cannot convert type 'System.Windows.Forms.HtmlElement' to 'mshtml.HTMLObjectElement' "

Then you're trying to cast to the wrong type. Try this:

HtmlDocument doc = (HtmlDocument)Webbrowser.Document;
        System.Windows.Forms.HtmlElement FirstElm = (System.Windows.Forms.HtmlElement)doc.All[0];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.