码迷,mamicode.com
首页 > Windows程序 > 详细

C#各个窗体之间如何传值啊!

时间:2014-09-10 09:34:50      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:http   ar   for   数据   on   c   r   as   c#   

1、你自定义窗体时为窗体增加相应的属性,比如:
class MyForm:Form{
....
private string something;
public string Something{get{return something;}set{something=value;}}
}
通过类似这种属性来传值:form1.Something=xxx

2、另一种是建立一个中间件来存储数据,比如建立一个Record类:
class Recordbubuko.com,布布扣{
public static string Something;
}
二个窗体互传值时通过Record.Something来设置和调用值:
比如在form1中调用 Record.Something="something"来设置要传的值,在form2中调用
xxx=Record.Something 来接收传来的值

C#各个窗体之间如何传值啊!

标签:http   ar   for   数据   on   c   r   as   c#   

原文地址:http://www.cnblogs.com/FLWL/p/3963742.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!