首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

兑现子窗口到主窗口的传值

2012-12-18 
实现子窗口到主窗口的传值在子窗口的两个textbox输入字符串后,他们的内容将会显示在主窗口的textbox上。子

实现子窗口到主窗口的传值

在子窗口的两个textbox输入字符串后,他们的内容将会显示在主窗口的textbox上。


子窗口的控件:两个textbox,两个button

子窗口:

?

?

namespace sign_in{    public partial class MainForm : Form    {        private string f_no;        private string f_name;        public string f_No        {            get            {                return this.f_no;            }            set            {                this.f_no = value;            }        }        public string f_Name        {            get            {                return this.f_name;            }            set            {                this.f_name = value;            }        }        public MainForm()        {            InitializeComponent();                    }       private void button1_Click(object sender, EventArgs e)        {            Child child = new Child();            if (child.ShowDialog() == DialogResult.OK)            {                this.textBox1.Text = child.c_No;                this.textBox2.Text = child.c_Name;            }        }    }}
?

?

?

热点排行