【全国软件开发交流群】131627487 【全国软件测试交流群】144758063 【全国计算机技术交流】131628626

从对话框中检索数据

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();

        }
posted @ 2011-04-16 10:55  编程中国  阅读(120)  评论(0)    收藏  举报