471,594 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

how to load file from current directory into WebBrowser control?

I want to load a document which would be residing in the same directory as
the application so I pass in a string to WebBrowser control which has no path
information- normally doing this with regular File IO it knows to go to
current directory but not WebBrowser. What do I need to change? Is there some
System property which stores the path the application is running from that I
can use?

string resource = "somefile.htm";
this.webBrowser1.DocumentStream = new FileStream(resource, FileMode.Open);

Nov 3 '06 #1
1 8569
Hi,

Use ApplicationExecutablePath to get the path of where you app is residing,
then you can just append the name of the file. something like

string filename = Application.ExecutablePath + "\\" + yourfilename;

HTH

Fitim Skenderi

"MrNobody" <Mr******@discussions.microsoft.comwrote in message
news:AE**********************************@microsof t.com...
>I want to load a document which would be residing in the same directory as
the application so I pass in a string to WebBrowser control which has no
path
information- normally doing this with regular File IO it knows to go to
current directory but not WebBrowser. What do I need to change? Is there
some
System property which stores the path the application is running from that
I
can use?

string resource = "somefile.htm";
this.webBrowser1.DocumentStream = new FileStream(resource, FileMode.Open);

Nov 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by standish22 | last post: by
11 posts views Thread by Webbert | last post: by
6 posts views Thread by titan.nyquist | last post: by
1 post views Thread by Fritz Switzer | last post: by
2 posts views Thread by Scott Gravenhorst | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.