Пример #1
0
        private void btnAdd_Click()
        {
            frmBook f1 = new frmBook(); //实例化窗体

            this.Visible = false;       //设置当前窗体为不可视

            f1.ShowDialog();            //打开窗体f1
            this.Visible = true;
        }
Пример #2
0
        private void btnEdit_Click()
        {
            string[] str = new string[dataGridView1.Rows.Count];
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Selected == true)
                {
                    Base_Book base_BookObject = new Base_Book();
                    base_BookObject.Id         = Convert.ToInt64(dataGridView1.Rows[i].Cells[0].Value);
                    base_BookObject.Name       = Convert.ToString(dataGridView1.Rows[i].Cells[1].Value);
                    base_BookObject.ReMark     = Convert.ToString(dataGridView1.Rows[i].Cells[2].Value);
                    base_BookObject.CreateDate = Convert.ToDateTime(dataGridView1.Rows[i].Cells[3].Value);

                    frmBook f1 = new frmBook(base_BookObject); //实例化窗体
                    this.Visible = false;                      //设置当前窗体为不可视
                    f1.ShowDialog();                           //打开窗体f1
                    this.Visible = true;
                }
            }
        }