简体   繁体   中英

How to navigate using WebBrowser Control

How to navigate using WebBrowser Control? I want to open a C:\\file1.html... an example code would be appreciated.

i first put a webcomponent as mentioned in the post " How do i open a webpage " in vb6 by adatapost

Private Sub Command1_Click()

WebBrowser1.Navigate2 "C:\\file1.html"

End Sub

this works but as u click on the button it pops a error..A error has occured on the scirpt of the page , line 6, Error: object expected, url: file:///C:file1/index.html, do u want to continue , yes or NO............................how to come around this error. ??

The VB code you have is correct, that is an error with the javascript on the page you are loading, so you can use:

Private Sub Command1_Click()

WebBrowser1.Navigate2 "C:\file1.html"

End Sub

But in Form_Load set silent mode, eg:

Private Sub Form_Load()

WebBrowser1.silent = true

End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM