在 C# 中更改 Web 浏览器的 URL

发布于 2024-10-10 12:48:52 字数 335 浏览 0 评论 0原文

我正在使用 C# 设计一个简单的应用程序,其中有一个 Web 浏览器。我需要(最好)刷新浏览器中当前的页面,或者导航到“新”网址。我尝试了 Browser.Url = new Uri("http://www.pandora.com/"); 但当我尝试编译它时出现错误。

错误 1 ​​无法隐式转换类型 ‘字符串’到 'System.Uri' c:\users\sean\documents\visual 工作室 2010\Projects\Pandora\Pandora\Form1.cs 51 27 潘多拉

我做错了什么?

I am designing a simple application using c# and it has a web browser in it. I need to either (preferably) refresh the page that is currently inside the broswer, or navigate to a "new" url. I tried Browser.Url = new Uri("http://www.pandora.com/"); but I get an error when I try to compile it.

Error 1 Cannot implicitly convert type
'string' to
'System.Uri' c:\users\sean\documents\visual
studio
2010\Projects\Pandora\Pandora\Form1.cs 51 27 Pandora

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南城旧梦 2024-10-17 12:48:52

出于某种原因,它希望我这样写:

Browser.Url = new System.Uri("https://www.pandora.com/", System.UriKind.Absolute);

这有效,所以很好。

For some reason, it wanted me to write it like this:

Browser.Url = new System.Uri("https://www.pandora.com/", System.UriKind.Absolute);

This works so thats good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文