コード例 #1
0
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            frmEnterpriseDbEdit f = new frmEnterpriseDbEdit();

            if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                SetBtnEnabled("");
        }
コード例 #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string KeyValue = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells[2].Value.ToString();
            if (KeyValue == "")
                return;
            if (e.ColumnIndex == 0)
            {
                frmEnterpriseDbView f = new frmEnterpriseDbView(KeyValue);

                if(f.ShowDialog()== System.Windows.Forms.DialogResult.OK)
                    SetBtnEnabled("");
            }
            else if (e.ColumnIndex == 1)
            {
                if (this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["Column13"].Value.ToString().Trim().Length > 0)
                {
                    MessageBox.Show("已被覆核,不可編輯!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                frmEnterpriseDbEdit f = new frmEnterpriseDbEdit(KeyValue);

                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    SetBtnEnabled("");
            }
        }