Newbie: Linking local files to WebBrowser 
Author Message
 Newbie: Linking local files to WebBrowser

Good day,

I am attempting to point the WebBrowser window to a local html file within
the working folder of the program. Working folder = folder where the exe is
located

Private Sub mnuViewWebBrowser_Click()
    Dim frmB As New frmBrowser

'NORMALLY SET AS...
    frmB.StartingAddress = " http://www.*-*-*.com/ "

'WHAT I WANT IS.....
    frmB.StartingAddress = "<working folder>/guide/index.htm"

    frmB.Show
End Sub

When I run the app, it wants to read the file location as an http:// address
(eg. http://guide/index.htm)
I want the WebBrowser to read from a file not an internet address.

HELP!!

Thanks,

Matt



Sun, 05 Aug 2001 03:00:00 GMT  
 Newbie: Linking local files to WebBrowser
Try file:///C|/<working folder>/guide/index.htm

Quote:

> Good day,

> I am attempting to point the WebBrowser window to a local html file within
> the working folder of the program. Working folder = folder where the exe is
> located

> Private Sub mnuViewWebBrowser_Click()
>     Dim frmB As New frmBrowser

> 'NORMALLY SET AS...
>     frmB.StartingAddress = "http://www.mywebpage.com"

> 'WHAT I WANT IS.....
>     frmB.StartingAddress = "<working folder>/guide/index.htm"

>     frmB.Show
> End Sub

> When I run the app, it wants to read the file location as an http:// address
> (eg. http://guide/index.htm)
> I want the WebBrowser to read from a file not an internet address.

> HELP!!

> Thanks,

> Matt


--
Robert Gelb
Developer Extraordinaire


Sun, 05 Aug 2001 03:00:00 GMT  
 Newbie: Linking local files to WebBrowser

Quote:
>Try file:///C|/<working folder>/guide/index.htm

That is exactly the problem I am facing. If I do not know where the user
will install the program, how do I know where <working folder> is?

TIA

Matt



Sun, 05 Aug 2001 03:00:00 GMT  
 Newbie: Linking local files to WebBrowser
Hello

The code "App.path" will return the path where your application is
installed.

Example:

Command1_Click()

Text1.Text = App.Path + "\Guide\Index.html"

End sub

Personally I Use This code to navigate my WebBrowser to a folder in the
working Path:

WebBrowser1.Navigate ( App.Path + "\MyFolder\MyFile.html")

If You need the slashes to be WEB-style ( / vs. \ ) then just find the
app.path and write some code for replacing the "\" with "/".

Hopes this helps, good luck!!

Trygve

-----------------------
Trygve H?iseth

http://home.sol.no/~thoiseth

Quote:

>>Try file:///C|/<working folder>/guide/index.htm

>That is exactly the problem I am facing. If I do not know where the user
>will install the program, how do I know where <working folder> is?

>TIA

>Matt




Mon, 06 Aug 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using WebBrowser ctl to navigate to a local file

2. Stopping WebBrowser from navigating to local files.

3. Stopping WebBrowser from navigating to local files.

4. Stopping WebBrowser from navigating to local files.

5. Webbrowser control for local .htm files

6. Help: prevent webbrowser ctrl getting access on local file system

7. GURU needed: VB6 webbrowser: Detect Navigation to local File system -- suppress new window

8. Stopping WebBrowser from navigating to local files.

9. Stopping WebBrowser from navigating to local files.

10. Stopping WebBrowser from navigating to local files.

11. Calling a local script file from a Web Page Link

12. Newbie q: Save Internet (HTML) file to local/Cancel ShowPrinter

 

 
Powered by phpBB® Forum Software