0

i want to cast this two typs

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

how can i do it

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by sknake
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];
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' "

0

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];
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.