private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                offeredsem = radioButton1.Text;
            }

            else if (radioButton2.Checked == true)
            {
                offeredsem = radioButton2.Text;
            }

            try
            {
                if ((textBox1.Text == string.Empty) || (textBox2.Text == string.Empty) || (textBox3.Text == string.Empty) || (offeredsem == string.Empty) || (numericUpDown1.Text == string.Empty) || (numericUpDown2.Text == string.Empty) || (numericUpDown3.Text == string.Empty) || (numericUpDown4.Text == string.Empty))
                {
                    MessageBox.Show("Warning:Required empty field:!", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return;
                }
                cn.Open();
                cm = new MySqlCommand("insert into tblsubject ( code, name, year, sem, lechrs, 	tutorialhrs, labhrs, evalutionhrs) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + offeredsem + "','" + numericUpDown1.Text + "','" + numericUpDown2.Text + "','" + numericUpDown3.Text + "','" + numericUpDown4.Text + "')", cn);
                cm.ExecuteNonQuery();
                cn.Close();
                MessageBox.Show("Record has been successfully saved.", "Lecturer Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Clear();
                button2.Enabled = false;


                this.Hide();
                ManageSub f2 = new ManageSub();
                f2.Show();
            }
            catch (Exception ex)
            {
                cn.Close();
                MessageBox.Show("Warning:" + ex.Message, "Waring", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            ManageSub f3 = new ManageSub();

            f3.Show();
        }