I need to pass a string value from Form1
:
public void button1_Click(object sender, EventArgs e)
{
string DepartmentName = "IT";
Form2 frm2 = new Form2();
Frm2.Show();
this.Hide();
}
into the Form2
Load
event. For example:
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";
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…