I have this error in my WebBrowser
Error: Unable to get value of the property 'length:' object is null or undefined
even though I have this code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ScriptErrorsSuppressed = True
Why am I getting this and how do I get rid of it?
If you are creating the Webbrowser componenet dynamically, I suggest that you set ScriptErrorsSurpressed = True
at that point.
Dim wb as New WebBrowser
wb.ScriptErrorsSurpressed = True
'Other declarations...
If it is not created dynamically, then I suggest that you go to the control and manually change the setting to True
in the design view.
If this doesn't work, please refer to my request/comment on your original post.
EDIT 1
This is your code:
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Page")
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
int = int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ScriptErrorsSuppressed = True
This is how I would write it:
Dim Browser As New WebBrowser
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
TabControl1.TabPages.Add("New Page")
TabControl1.SelectedTab.Controls.Add(Browser)
int = int + 1
Browser.GoHome()
Browser.ScriptErrorsSurpressed = True
I see no need for CType()
at all.
您收到错误是因为 yts/bin 文件夹中http://s.ytimg.com服务器上的 javascript 文件 (www-home-vflVATumV.js) 有错误或发现任何 LENGTH 属性的动态错误它试图评估的对象。
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.