Public Class frmManageSubjects
    Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
        Dim f As frmAddEditSubjects = New frmAddEditSubjects()
        f.FormBorderStyle = FormBorderStyle.None
        f.StartPosition = FormStartPosition.CenterScreen
        f.ShowDialog()
    End Sub

    Private Sub frmManageSubjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        sql = "SELECT  `SUBJ_ID`, `SUBJ_CODE`, `SUBJ_DESCRIPTION`, `YR`, `AY` FROM `subject`"
        fillListView(sql, lstViewSubj)
    End Sub

    Private Sub txtsearch_TextChanged(sender As Object, e As EventArgs) Handles txtsearch.TextChanged
        sql = "SELECT  `SUBJ_ID`, `SUBJ_CODE`, `SUBJ_DESCRIPTION`, `YR`, `AY` FROM `subject`" _
        & " WHERE `SUBJ_ID` LIKE '%" & txtsearch.Text & "%' OR `SUBJ_CODE` LIKE '%" _
        & txtsearch.Text & "%' OR `SUBJ_DESCRIPTION`  LIKE '%" & txtsearch.Text & "%'"
        fillListView(sql, lstViewSubj)
    End Sub

    Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
        sql = "DELETE FROM `subject` WHERE `SUBJ_ID`='" & lstViewSubj.SelectedItems.Item(0).Text & "'"
        messageTrue = "Subject has been deleted."
        messageFalse = "Subject failed to delete."
        CreateUpdateDeleteAllMessage(sql, messageTrue, messageFalse)
        Call frmManageSubjects_Load(sender, e)
    End Sub

    Private Sub btnEdit_Click(sender As Object, e As EventArgs) Handles btnEdit.Click
        Try
            Dim id = lstViewSubj.SelectedItems.Item(0).Text
            Dim f As frmAddEditSubjects = New frmAddEditSubjects()
            f.FormBorderStyle = FormBorderStyle.None
            f.StartPosition = FormStartPosition.CenterScreen
            f.lblid.Text = id
            f.ShowDialog()

        Catch ex As Exception
            MsgBox(ex.Message & "lstViewSubj_DoubleClick", MsgBoxStyle.Exclamation)
        End Try


    End Sub
End Class