C#:从Windows应用程序内部启动URL

C#:从Windows应用程序内部启动URL

问题描述:

 

我是C#的新手,想知道是否有人可以提供从Windows窗体中启动默认网站的示例代码?我有一个带有各种按钮的用户窗体.我想单击一个按钮,然后启动所需的Intranet网站.我在网上闲逛,这就是我发现的东西:-

I am new to C#, and was wondering if someone could provide sample code for launching a default website from within a windows form? I have a userform with various buttons. I would like to click on a button and then launch the desired intranet website. I poked around the web and this is what I have found:-

 

私人 void button8_Click( object 发件人 EventArgs e)

Private void button8_Click(object sender, EventArgs e)

{

字符串 targetURL = @http: //www .duncanmackenzie.net;

string targetURL = @http://www.duncanmackenzie.net;

System.Diagnostics. 处理 .Start(targetURL);

System.Diagnostics.Process.Start(targetURL);

}

非常感谢您的帮助.

 

 

你好,

您希望如何实施?

您是否正在表单中使用浏览器控件(将在您的应用程序中打开网络浏览器)

Are you using a browser control in your form (a web browser will open within your application)

还是要使用最终用户浏览器(表单将使用外部浏览器)?

Or are you wanting to use the end-users browser (form will use external browser)?