Open a webpage in the default browser

后端 未结 8 1627
我寻月下人不归
我寻月下人不归 2020-12-03 20:39

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?

I\'m using VB.net so all .net e

8条回答
  •  有刺的猬
    2020-12-03 21:33

    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://faithlife.codes/blog/2008/01/using_processstart_to_link_to/

    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.

提交回复
热议问题