从对话框中检索数据
Form2:
Form1 mainForm;
public Form2(Form1 mainForm)
{
this.mainForm = mainForm;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.textBox1.Text != string.Empty)
{
mainForm.listBox1.Items.Clear();
string[] stringsEntered = textBox1.Lines;
for (int count = 0; count < stringsEntered.Length; count++)
{
mainForm.listBox1.Items.Add(stringsEntered[count]);
}
}
this.Close();
}
Form2:
private void button3_Click(object sender, EventArgs e)
{
Form2 subForm = new Form2(this);
subForm.Show();
}
浙公网安备 33010602011771号