Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I turn this: WebBrowser1 1

Status
Not open for further replies.

Vec

IS-IT--Management
Jan 29, 2002
418
0
0
US
How can I turn this:

WebBrowser1.Navigate "file://F:\folder\filename.html"

into the
Code:
File = App.Path
method so I don't have to have a hard coded path. The file will always be located in the same dir as the app

-------------------------------------------------------------------------
-------------------------------------------------------------------------

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Univer
 
WebBrowser1.Navigate AppPath & "\filename.html"
 
App.Path sorry

Here's a little trick to clear the webrowser so you dont get the 'this page cannot be found' displayed..

WebBrowser1.Document.body.innerHtml = " "
 
Unsure how to use:
WebBrowser1.Document.body.innerHtml = " "
LPlates. In the form load or what?

-------------------------------------------------------------------------
-------------------------------------------------------------------------

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Univer
 
Runtime error "91";
Object variable or With block variable not set

-------------------------------------------------------------------------
-------------------------------------------------------------------------

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Univer
 
Whoops, my mistake. Place it anywhere other than Form_Load, for the example place it in a command button

[red]Note:[/red] Also, you must save your project then reopen your project for it to work. Or you will get the same error!!
(You will notice the first time you draw the control it is white/no borders, once you reopen the project it displays page not found) This has something to do with it but not sure exactly what.

If you want it to clear the webbrowser when the app loads, place a timer on your form and set the interval to 50, in the timer add this...

Sub Timer1_Timer()
WebBrowser1.Document.body.innerHtml = " "
Timer1 = False
End Sub
 
Tried it in a timer, locks up the app. I have read somewhere that these innerhtml calls are hard to use. What am I missing??
I have a WeBrowser named WebMain and a timer named Timer4 here is my code:

In the form load event I have:
Code:
Timer4.Enabled = True

Then in Timer4:
Code:
Private Sub Timer4_Timer()
Code:
WebMain.Document.body.innerHtml = " "
Code:
Timer4.Enabled = False
Code:
End Sub

-------------------------------------------------------------------------
-------------------------------------------------------------------------

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
- Albert Einstein (1879-1955)
 
Did you save then re open the project before trying the timer?
 
Yes. Still doesn't like me :(

-------------------------------------------------------------------------
-------------------------------------------------------------------------

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
- Albert Einstein (1879-1955)
 
I just tried a few things, this is working for me in the form load event...

WebBrowser1.Navigate2 "about:blank"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top