在默认浏览器打开网页 [英] Open a webpage in the default browser

查看:155
本文介绍了在默认浏览器打开网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的用户可以点击一个按钮,点击后在默认浏览器中打开我公司的网页。我会怎么做呢?

I want my users to be able to click a button to open my company's webpage in the default browser when clicked. How would I do this?

我用VB.net,因此所有.NET的例子是可以接受的。

I'm using VB.net so all .net examples are acceptable.

推荐答案

正如其他人所指出的,的Process.Start()是去这里的道路。然而,也有一些怪异。这是值得你花时间阅读这篇博客:结果
<一href=\"http://$c$c.logos.com/blog/2008/01/using_processstart_to_link_to.html\">http://$c$c.logos.com/blog/2008/01/using_processstart_to_link_to.html

As others have indicated, Process.Start() is the way to go here. However, there are a few quirks. It's worth your time to read this blog post:
http://code.logos.com/blog/2008/01/using_processstart_to_link_to.html

总之,一些浏览器会导致它抛出一个异常,没有很好的理由,该功能可以阻止非UI线程一段时间,所以你需要确保它发生不久的任何其他行动可能会在执行结束同一时间,你可能要更改光标外观,同时等待浏览器中打开。

In summary, some browsers cause it to throw an exception for no good reason, the function can block for a while on non-UI thread so you need to make sure it happens near the end of whatever other actions you might perform at the same time, and you might want to change the cursor appearance while waiting for the browser to open.

这篇关于在默认浏览器打开网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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