特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP教程> winform窗体传值小结

winform窗体传值小结

时间:2009-12-23 16:54:02 作者:互联网

1 用属性传值

(子窗体)

private ArrayList arrlOut;

public ArrayList arrlIn//要用pulibc

        {
            set
            {
                this .arrlOut    = value;//这里不能用arrlIn而要单独声明一个变量
            }
            get
            {
                return this .arrlOut  ;
            }
        }

(主窗体,由它向子窗体传传值)

using Sy***m.Collections;//ArrayList引用空间

private  ArrayList arrlOut;

private void btnShowForm4_Click(object sender, EventArgs e)
        {
            Form4 form4StudentInformation = new Form4();           
            fo***StudentInformation.arrlIn ; = th***arrlOut ;
            fo***StudentInformation.Show();
        }

2用方法传值

(主窗体)

using Sy***m.Collections;//ArrayList引用空间

private  ArrayList arrlOut;

private void btnShowForm3_Click(object sender, EventArgs e)
        {
            Form3 formStudentInformation = new Form3();
            fo***tudentInformation.setArray(arrlOut);
            fo***tudentInformation.Show();
        }

(子窗体)

private ArrayList arrlOut;

public  void setArray(ArrayList arrayin)//要用pulibc
        {
            arrlOut = arrayin;

          
        }

3构造函数传值

(子窗体)

private ArrayList arrlOut;
        public studentOneInformationForm(ArrayList   arrlIn)//构造函数中加了参数
        {
            InitializeComponent();
            arrlOut = arrlIn;
        }

(主窗体)

private void showFormInformation_Click(object sender, EventArgs e)
        {
            studentOneInformationForm studentOne = new studentOneInformationForm(th***arrlOut);//传参数
            st***ntOne.Show();
          
        }

 

 

相关文章

相关应用

热门文章

猜你喜欢

返回顶部