How to get the computed CSS styles that get applied to the element in the browser using .NET?

Hi All,

I have a web browser (System.Windows.Forms.WebBrowser) control in my VB.NET windows application. I load some URL into this control. Then I loop through all the element in WebBrowser1.Document.DomDocument.All using the mshtml.IHTMLElement as the element interface and try to get some of the properties of the elements (like id etc.).

What I also need to do is to be able to get the inherited computed styles getting applied to the elements from external (as well as inline) CSS. I have done a lot of research on the web and found  javascript solutions (using getComputedStyle), but haven't found any .NET solutions that I can use directly from VB.NET. I did see on MSDN that there is a IDisplayServices::GetComputedStyle Method (http://msdn.microsoft.com/en-us/library/aa752657(VS.85).aspx), but I am not able to use it from VB.NET. Looks like mshtml does not support it from VB.

Is there any other way or approach that I can use so that I can get the computed CSS styles getting applied to a particular element from VB.NET or C#.NET??? I really need to be able to get the computed CSS styles. Will greatly appreciate if some one will be able to help me out.
instaknowAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silvera21Commented:
No, you cannot get styles that are computed after the page reaches the browser with a server side language. You have to use javascript. You can however, use AJAX to pass the computed styles back to the server and send them back (if needed), and then use javascript again to apply any other changes if needed. But it must be a client side language that sets any info in the client.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.