Public Class frmManageStudents
    Private Sub frmManageStudents_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'for student list
        sql = "SELECT `IDNO`, CONCAT(`FNAME` ,' ', `LNAME`,' ', `MNAME`) as 'FULL NAME', `SEX` , `AGE`, `HOME_ADD` as 'ADDRESS'  FROM `tblstudent`"
        fillListView(sql, lstViewStudent)


    End Sub

    Private Sub txtSearch_TextChanged(sender As Object, e As EventArgs) Handles txtSearch.TextChanged

        sql = "SELECT `IDNO`, CONCAT(`FNAME` ,' ', `LNAME`,' ', `MNAME`) as 'FULL NAME', `SEX`" _
        & ", `AGE`, `HOME_ADD` as 'ADDRESS'" _
        & " FROM `tblstudent` WHERE `IDNO` like '%" & txtSearch.Text & "%'" _
        & " OR `FNAME` like '%" & txtSearch.Text & "%' OR `LNAME` like '%" & txtSearch.Text & "%'"
        fillListView(sql, lstViewStudent)


    End Sub

    Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
        Try
            'student siblings
            sql = "DELETE FROM `tblstudsiblings`  WHERE `IDNO` ='" & lstViewStudent.SelectedItems.Item(0).Text & "'"
            deleting(sql)
            'students details
            sql = "DELETE FROM  `tblstuddetails`  WHERE `IDNO` ='" & lstViewStudent.SelectedItems.Item(0).Text & "'"
            deleting(sql)
            'student(requirements)
            sql = "DELETE FROM   `tblrequirements` WHERE `IDNO` ='" & lstViewStudent.SelectedItems.Item(0).Text & "'"
            deleting(sql)
            'student basic info
            sql = "DELETE FROM tblstudent WHERE `IDNO` ='" & lstViewStudent.SelectedItems.Item(0).Text & "'"
            messageTrue = "Student has been deleted."
            messageFalse = "Student Failed to delete."
            CreateUpdateDeleteAllMessage(sql, messageTrue, messageFalse)
            Call frmManageStudents_Load(sender, e)
        Catch ex As Exception
            MsgBox("Select a students first.", MsgBoxStyle.Exclamation)
        End Try
    End Sub

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

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