private void GunaDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = gunaDataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "Edit")
            {
                frmStudent frm = new frmStudent(this);
                frm.btnSave.Enabled   = false;
                frm.lblID.Text        = gunaDataGridView1[1, e.RowIndex].Value.ToString();
                frm.txtStudentNo.Text = gunaDataGridView1[2, e.RowIndex].Value.ToString();
                frm.txtLname.Text     = gunaDataGridView1[3, e.RowIndex].Value.ToString();
                frm.txtFname.Text     = gunaDataGridView1[4, e.RowIndex].Value.ToString();
                frm.txtMi.Text        = gunaDataGridView1[5, e.RowIndex].Value.ToString();
                frm.cboCourse.Text    = gunaDataGridView1[6, e.RowIndex].Value.ToString();
                frm.cboYear.Text      = gunaDataGridView1[7, e.RowIndex].Value.ToString();
                frm.cboGender.Text    = gunaDataGridView1[8, e.RowIndex].Value.ToString();
                frm.txtContact.Text   = gunaDataGridView1[9, e.RowIndex].Value.ToString();
                frm.txtEmail.Text     = gunaDataGridView1[10, e.RowIndex].Value.ToString();
                frm.txtAddress.Text   = gunaDataGridView1[11, e.RowIndex].Value.ToString();
                frm.ShowDialog();
            }
            else if (colName == "Delete")
            {
                if (MessageBox.Show("Are you sure you want to delete this record?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    cn.Open();
                    cm = new SqlCommand("DELETE FROM tblStudent WHERE studID like '" + gunaDataGridView1[1, e.RowIndex].Value.ToString() + "'", cn);
                    cm.ExecuteNonQuery();

                    cn.Close();
                    MessageBox.Show("Record has been successfully deleted!", stitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadRecords();
                }
            }
        }
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            frmStudent frm = new frmStudent(this);

            frm.btnUpdate.Enabled = false;
            frm.Show();
        }