表单按钮丁当事件的应用程序代码以将您带到url [英] forms app code for buton click event to take you to a url

查看:44
本文介绍了表单按钮丁当事件的应用程序代码以将您带到url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚进入开发阶段.我想知道设置带有按钮的Windows窗体有多困难,当单击每个按钮时,它们会将您带到不同的URL.请帮忙.

谢谢,

Jason

I am just getting into development. I was wondering how hard would it be to setup a windows form with buttons that when clicked each of them would take you to a different url. Please Help.

Thanks,

Jason

推荐答案

最简单的方法是使用
The easiest way would be to use Process.Start Method[^].
Process.Start("http:\\www.codeproject.com");


如果您正在使用Web应用程序,则只需在代码背后的按钮单击处理程序中执行Response.Redirect("http://mysite.com/"). /> 如果您正在处理表单应用程序,则只需在点击处理程序中使用它即可:
If you are working with a web application, then you just need to do a Response.Redirect("http://mysite.com/") in the button click handler in the code-behind.
If you are working on a forms application, then you just need this in your click handler:
ProcessStartInfo sInfo = new ProcessStartInfo("http://mysite.com/");  
Process.Start(sInfo);


这篇关于表单按钮丁当事件的应用程序代码以将您带到url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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