我需要從Form1
傳遞一個字符串值:如何從一種形式傳遞字符串值,以另一種形式的Load事件在C#
public void button1_Click(object sender, EventArgs e)
{
string DepartmentName = "IT";
Form2 frm2 = new Form2();
Frm2.Show();
this.Hide();
}
到Form2
Load
事件。例如:
private void Form2_Load(object sender, EventArgs e)
{
MessageBox.Show(DepartmentName);
// or
// string sql1 = "select Service_Name from Service, " +
// "EmployeeService where E_Dep = '" + DepartmentName + "' " +
// "and s_ID = Service_ID";
}
謝謝它的工作,因爲我需要 – AbdelMalek 2011-06-06 23:33:01