コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Add_nat add_nat = new Add_nat();


            add_nat.button3.Enabled  = true;
            add_nat.button5.Enabled  = false;
            add_nat.textBox1.Enabled = true;
            openContentForm(new Add_nat());
        }
コード例 #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "colEdit")
            {
                Add_nat add_nat = new Add_nat();


                add_nat.button3.Enabled      = false;
                add_nat.button5.Enabled      = true;
                add_nat.textBox1.Enabled     = false;
                add_nat.textBox1.Text        = _id;
                add_nat.comboBox2.Text       = _lecturer;
                add_nat.comboBox3.Text       = _group;
                add_nat.comboBox4.Text       = _sub_gp;
                add_nat.comboBox1.Text       = _day;
                add_nat.dateTimePicker2.Text = _stime;
                add_nat.dateTimePicker3.Text = _etime;
                this.Hide();
                add_nat.Show();
            }
            else if (colName == "colDelete")

            {
                if (MessageBox.Show("Are you sure you want to delete this record ?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ;
                }
                {
                    cn.Open();
                    cm = new MySqlCommand("delete from add_nat where ID like'" + _id + "' ", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Record has been Successfully deleted !", "Deleted Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadRecords();
                }
            }
        }