Public Class frmAddEditSubjects
    Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
        If lblid.Text = "ID" Then
            sql = "INSERT INTO `subject` (`SUBJ_CODE`, `SUBJ_DESCRIPTION`, `YR`, `AY`)" _
                   & " VALUES ('" & txtsujCode.Text & "','" & txtsubjDesc.Text & "','" _
                   & cboYear.Text & "','" & cbosy.Text & "')"
            messageTrue = "Subject has been saved."
            messageFalse = "Failed to save a sabject."
            CreateUpdateDeleteAllMessage(sql, messageTrue, messageFalse)
        Else
            sql = "UPDATE `subject` SET `SUBJ_CODE`='" & txtsujCode.Text & "', `SUBJ_DESCRIPTION`='" & txtsubjDesc.Text & "', `YR`='" _
                    & cboYear.Text & "', `AY`='" & cbosy.Text & "' WHERE SUBJ_ID ='" & lblid.Text & "'"
            messageTrue = "Subject has been updated."
            messageFalse = "Failed to update a sabject."
            CreateUpdateDeleteAllMessage(sql, messageTrue, messageFalse)
        End If
    End Sub
    Private Sub lblid_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblid.TextChanged

        If lblid.Text = "ID" Then
            sql = "SELECT * FROM ay"
            fillCombo(sql, cbosy, "ACADYR")
            clearGroupTxt(Panel1)
        Else
            sql = "SELECT   `SUBJ_CODE`, `SUBJ_DESCRIPTION`, `YR`, `AY` FROM `subject` WHERE `SUBJ_ID`='" & lblid.Text & "'"
            fillSpecifictxt(sql)
            txtsujCode.Text = dt.Rows(0).Item("SUBJ_CODE")
            txtsubjDesc.Text = dt.Rows(0).Item("SUBJ_DESCRIPTION")
            cboYear.Text = dt.Rows(0).Item("YR")
            cbosy.Text = dt.Rows(0).Item("AY")
        End If


    End Sub

    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub
End Class