Example #1
0
        private void btnNewCom_Click(object sender, EventArgs e)
        {
            Account account = new Account();

            account.Owner = this;

            //新建时,将数据源解绑定。
            this.dataGridView1.DataSource = null;


            account.ShowDialog();
        }
Example #2
0
        private void dataGridView1_DoubleClick
            (object sender, EventArgs e)
        {
            int sltRow
                = dataGridView1.CurrentCell.RowIndex;

            string strStatus
                = dataGridView1.Rows[sltRow].
                Cells["状态"].Value.ToString();

            if (strStatus == "未启用")
            {
                string strId
                    = dataGridView1.Rows[sltRow].
                    Cells["Id"].Value.ToString();

                Account ac = new Account(strId);
                ac.Owner = this;
                ac.ShowDialog();
            }
            else if (strStatus == "已启用")
            {
                Msg("请先停用,再尝试修改.", "警告信息", "warning");
                return;
            }
        }