我希望在父窗体上弹出一个对话框,对话框中有一个文本框,点击确定后把文本框的文本内容返回给父窗体,请问怎么实现?分不多,但会很快结贴

解决方案 »

  1.   

    var str = confirm("input")
      

  2.   

    http://blog.csdn.net/deanlee1982/archive/2007/08/07/1729548.aspxusing System;
    using System.Text;
    using System.Collections.Generic;
    namespace demo

        public class Observe 
        {  
            private string strText;    
            public string StrText
             {
                get     
                {
                  return strText;
                }   
                set
                {   
                  strText = value;  
                } 
            }  
           public Observe()
            {  
               // TODO: 在此处添加构造函数
            } 
        }
    } 然后在Form2(即发送值的窗体)中定义一个Observe成员
     
     private Observe o_Observer;
      public Observe observe
      {
       set
       {
        this.o_Observer = value;
       }
      }
    在Form2的事件处理中改变o_Observe的StrText
     
    private void button1_Click(object sender, System.EventArgs e)
      {
       o_Observer.StrText = this.textBox1.Text;
       this.Close();
      }然后在Form1(即接收值的窗体中)取得Form2传来的值
           private void button1_Click(object sender, EventArgs e)
            {
                Form2 fm= new Form2();
                fm.observe = o_Observe;
                fm.ShowDialog();
                if (o_Observe.strText != null)
                    Textbox1.Text = o_Observe.strText;
            }
      

  3.   

    楼主去看看我的BLOG,有这个题目。blog.csdn.net/whChina
      

  4.   

    http://blog.csdn.net/smallcoolpig/archive/2007/06/24/1664614.aspx
      

  5.   

    kkun_3yue3(嘟啊嘟啊嘟啊嘟) ( ) 正解