1 用属性传值
(子窗体)
private ArrayList arrOut;
public ArrayList arrlIn//要用pulibc
{
Satz
{
this .arrlOut = value;//这里不能用arrlIn而要单独声明一个变量
}
erhalten
{
gib dies zurück .arrlOut ;
}
}
(主窗体,由它向子窗体传传值)
using System.Collections;//ArrayList-Objekte
private ArrayList arrOut;
private void btnShowForm4_Click(object sender, EventArgs e)
{
Form4 form4StudentInformation = new Form4();
form4StudentInformation.arrlIn = this.arrlOut ;
form4StudentInformation.Show();
}
2用方法传值
(主窗体)
using System.Collections;//ArrayList-Objekte
private ArrayList arrOut;
private void btnShowForm3_Click(object sender, EventArgs e)
{
Form3 formStudentInformation = new Form3();
formStudentInformation.setArray(arrlOut);
formStudentInformation.Show();
}
(子窗体)
private ArrayList arrOut;
public void setArray(ArrayList arrayin)//要用pulibc
{
arrlOut = arrayin;
}
3构造函数传值
(子窗体)
private ArrayList arrOut;
public studentOneInformationForm(ArrayList arrlIn)//构造函数中加了参数
{
InitializeComponent();
arrlOut = arrlIn;
}
(主窗体)
private void showFormInformation_Click(object sender, EventArgs e)
{
studentOneInformationForm studentOne = new studentOneInformationForm(this.arrlOut);//传参数
studentOne.Show();
}