private void button1_Click(object sender, EventArgs e) { this.Hide(); AddSub f2 = new AddSub(); f2.Show(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { string colName = dataGridView1.Columns[e.ColumnIndex].Name; if (colName == "colEdit") { AddSub frm = new AddSub(); frm.button1.Enabled = false; frm.button2.Enabled = true; frm.textBox1.Text = _code; frm.textBox2.Text = _name; frm.textBox3.Text = _year; frm.radioButton1.Text = _sem; frm.radioButton2.Text = _sem; frm.numericUpDown1.Text = _lechrs; frm.numericUpDown2.Text = _tutorialhrs; frm.numericUpDown3.Text = _labhrs; frm.numericUpDown4.Text = _evalutionhrs; frm.ShowDialog(); } 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 tblsubject where code like'" + _code + "'", cn); cm.ExecuteNonQuery(); cn.Close(); MessageBox.Show("Record has been Successfully deleted !", "Deleted Record", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadRecord(); } } }