472,789 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Web Browser control - how to navigate to a local file.

I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:

string path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName) +
"\\howdoi.htm";
webBrowser1.Navigate(path);

What do I need to do to form the correct URI string for a local file?

Thanks.

Sep 20 '07 #1
5 23288
Once you get the assembly for the executing assembly, you will want to
use the Location property on the assembly to get the directory that the
assembly is in.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ti*****@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
>I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:

string path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName) +
"\\howdoi.htm";
webBrowser1.Navigate(path);

What do I need to do to form the correct URI string for a local file?

Thanks.

Sep 20 '07 #2
On Sep 20, 9:56 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Once you get the assembly for the executing assembly, you will want to
use the Location property on the assembly to get the directory that the
assembly is in.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<timn...@gmail.comwrote in message

news:11**********************@19g2000hsx.googlegro ups.com...
I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:
string path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName) +
"\\howdoi.htm";
webBrowser1.Navigate(path);
What do I need to do to form the correct URI string for a local file?
Thanks.
Thanks but the path comes out as C:\....\howdo.ihtm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?

Sep 20 '07 #3
When you call navigate, it should take a file name just fine and
navigate to it. It it doesn't, then there is something else wrong (perhaps
the file name is wrong).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ti*****@gmail.comwrote in message
news:11**********************@r29g2000hsg.googlegr oups.com...
On Sep 20, 9:56 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
> Once you get the assembly for the executing assembly, you will want
to
use the Location property on the assembly to get the directory that the
assembly is in.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<timn...@gmail.comwrote in message

news:11**********************@19g2000hsx.googlegr oups.com...
>I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:
string path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName) +
"\\howdoi.htm";
webBrowser1.Navigate(path);
What do I need to do to form the correct URI string for a local file?
Thanks.

Thanks but the path comes out as C:\....\howdo.ihtm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?

Sep 20 '07 #4
Hi.
Thanks.

Thanks but the path comes out as C:\....\howdo.ihtm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?
Try it with IE, maybe you should use file://c:\......
Sep 20 '07 #5
On Sep 20, 10:21 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
When you call navigate, it should take a file name just fine and
navigate to it. It it doesn't, then there is something else wrong (perhaps
the file name is wrong).

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<timn...@gmail.comwrote in message

news:11**********************@r29g2000hsg.googlegr oups.com...
On Sep 20, 9:56 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Once you get the assembly for the executing assembly, you will want
to
use the Location property on the assembly to get the directory that the
assembly is in.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
<timn...@gmail.comwrote in message
>news:11**********************@19g2000hsx.googlegr oups.com...
I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:
string path = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName) +
"\\howdoi.htm";
webBrowser1.Navigate(path);
What do I need to do to form the correct URI string for a local file?
Thanks.
Thanks but the path comes out as C:\....\howdo.ihtm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?
Sorry, the file name was so long I missed a character I had mistyped.
Sorry to bother you.

Sep 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture...
20
by: Steve | last post by:
I have a web app that needs to parse through a file that is located on the client machine. I get the file string from a query string & then parse it. It is working fine on my development box but...
3
by: Christopher D. Wiederspan | last post by:
I've got a WebBrowser control in a C# Windows form. I build HTML on the fly and then set it into the control using the DocumentText property of the control. All of this works fine, except that part...
0
by: Grant | last post by:
I have an application written in c# using the Web Browser Control. I also created a setup package to distribute this application on various machines all running windows xp or 2000. When i...
0
by: Khalilskp | last post by:
I have used wbe browser control in my project. I place two web browser control on two different froms. I want to login on a site by giving two user name and password. when i give login name and...
1
by: PJSimon | last post by:
I have a VB.Net form with a Microsoft Web Browser control in it. I navigate to an XML file on my computer, then I change the XML document , then I navigate to the XML file again. The browser...
2
by: samp | last post by:
Hi All, How can i download files using web browser control? I want to be able to automtaically download files giving the file a location and name. I am getting the download file dialog box which...
2
by: Lyle Fairfield | last post by:
I am using Microsoft’s Web Browser Control embedded on an Access Form to browse a specific site. I have a good reason for doing so; the pages on this site run code which aborts their display unless...
1
by: celoftis | last post by:
BACKGROUND: I have some PPT slides that have been converted to HTM (ensuring that the show slide animations while browsing checkbox is checked). The original HTM slides have custom animations to...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.