SolveErrors
VB.NET

How would I add HTML/CSS/Image files to my project? (for the WebBrowser control)

20 views

Hey guys,

I have a WebBrowser control and would like it to display HTML/CSS/Image files that I add to My.Resources, but can't figure out how to do that. Whenever I try to add an HTML file to My.Resources, it automatically converts it to a text file.

No problem there, as I can still get the HTML code out of that text file and display it using...

WebBrowser1.DocumentText = My.Resources.HTML_File

But that HTML file relies on a CSS file and several image files (all using relative paths).

But when I try to add the CSS file to My.Resources, it turns that into a txt file as well.

So is there any way to import HTML/CSS/Images files to My.Resources where they will all work together? (ie display properly in the WebBrowser control)

Or is there a better way to add them to the project other than using "My Resources"?

I guess if I had to, I could include the CSS code inside the HTML file, but then how would I reference the images from within the HTML code? ,
Quote Originally Posted by kevininstructor View Post
Check out the attached project originally done in VS2008, just upgraded to VS2010 along with added some code which goes with that dunfiddlin indicated to use which does work. Would had replied yesterday but was configuring a new computer.
Hey Kevin,

Thanks for sharing that code. Very cool! Are the HTML/CSS, etc files ever stored anywhere on the end-users computer, or does all of that stay embedded in the distributed exe?

Also, I'd prefer to target the .NET 2.0 framework if possible, so do you know if it's possible to do this without using LINQ? (as far as I can tell, the LINQ references are the only thing that is keeping this from being compatible with 2.0).

Thanks!

More VB.NET fixes

Is it possible to add an array as double?VB6 to VB .Net listviewAccess Active Directory and search Security groups for a user via vb.netHelp required drawing dotted path lines, with even dots along the path lineclose error and reopen program?Re: Retrieve multiple records from ... where ...