I was looking around and saw the post for using resource
(how-to-create-and-use-resources-in-net)
. I learned how to put a file into the resources for the project and programmatically retrieve it. But, I’m not seeing the idea of having resources, maybe?
I have a tab on a form where I have a webbrowser control, but I just want to show a help document.
I put the html file as a resource, but when I print out after looking up the resource, it gives me all the file’s text (html tags) instead of just the name of the file, such that I could do something like
helpBrowser.Url = new Uri("file//:"+Properties.Resources.help);
I might need a different approach. Im using the control not to actually browse but just display a page, which isnt the intended use exactly.
Thanks, guys. StackOverflow is great!
WebBrowser is an unmanaged component under the hood, it doesn’t know anything about .NET resources. There’s a protocol for it to read unmanaged resources but you don’t want to go there. Simply use the DocumentText property:
Beware the usual trouble with displaying off-line HTML, it won’t know where to find any images you embedded in the html. If that’s a deal breaker then you are better off having the files on disk. Which is the all-around better solution for large files anyway.