WebBrowser错误 [英] WebBrowser error

查看:108
本文介绍了WebBrowser错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助!我很失望!我从通用控件"创建了一个Web浏览器.当我输入以下行时:
webBrowser1.Navigate("somedir \\ somefile.htm");
,我在浏览器中什么也没有.

HELP! I''m desprate! I created a web browser from "Common Controls". When I type following line:
webBrowser1.Navigate("somedir\\somefile.htm");
, I get nothing in browser.

推荐答案

请尝试使用真实的URL. IE通过猜测url指向何处并做正确的事情"(至少是IE开发人员认为应该是正确的事情)破坏了所有人.

使用它作为文件系统的URL
String fileURL = "file:///C:/Folder1/folder2/someFile.html";

您必须使用正确的系统驱动器和文件夹名称.

干杯,

Manfred
Please try to use a real URL. IE is spoiling you all by guessing where an url points to and doing "the right thing" (well at least what the IE developers thought should be the right thing).

Use this for an URL to the file system
String fileURL = "file:///C:/Folder1/folder2/someFile.html";

You''ll have to use the correct drive and folder names of your system.

Cheers,

Manfred


尝试将代码放入try/catch块中,然后在调试器下运行应用程序.

哦,是的-在您要浏览的文件名中使用正斜杠而不是反斜杠.

Try putting the code into a try/catch block and then running the app under the debugger.

And oh yeah - use forward slashes instead of backslashes in the file name you''re trying to browse to.


这篇关于WebBrowser错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆