委托、事件--实现窗体传值!

一、主窗体界面

     Form2 frm = new Form2();
            frm.AccountEvent += new Form2.AccountDelegate(frm_AccountEvent);
            frm.Show();

二、工具界面

    

    public delegate void AccountDelegate(string number);
        public event AccountDelegate AccountEvent;

          private void button1_Click(object sender, EventArgs e)
          {
              if (AccountEvent!=null)
              {
                  AccountEvent(textBox1.Text);
                  Close();
              }
          }

    

posted on 2013-04-09 16:08  ancient_sir  阅读(174)  评论(0编辑  收藏  举报