Example #1
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            string   name = nameTextBox.Text;
            DateTime dt   = meetDTP.Value;

            bf = new Boyfriend(name, dt);
        }
Example #2
0
        private void openButton_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2("未知男友");
            // f2.Show();                               // 非模式
            DialogResult dr = f2.ShowDialog();          // 模式,返回值为枚举类型

            if (dr == DialogResult.OK)                  // 单击确定按钮
            {
                Boyfriend bf = f2.BF;
                bfs[n] = bf;
                n++;
                showLabel.Text = bf.show();
            }
            if (dr == DialogResult.Cancel)              // 单击取消按钮
            {
                showLabel.Text = "窗体 f2 的操作被取消!";
            }
        }
Example #3
0
        Boyfriend bf;                       // 封装所有返回到 Form1 中的值

        public Form2()
        {
            InitializeComponent();
            bf = null;
        }