Public Class frmEForm
    Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
        For Each txt As Control In GroupBox1.Controls
            If txt.GetType Is GetType(TextBox) Then
                If txt.Text = "" Then
                    MsgBox("One of the box is empty on the student details,You must fill it", MsgBoxStyle.Exclamation)
                    Return
                Else
                    If rdoMale.Checked = True Then
                        radioSEX = "MALE"
                    Else
                        radioSEX = "FEMALE"
                    End If
                    checkOption(chkBirthCert, Nyesno)
                    checkOption(chkCertification, Cyesno)
                    checkOption(chkPic, Pyesno)
                    checkOption(chkReportCard, Ryesno)

                    'student(requirements)
                    sql = "INSERT INTO  `tblrequirements` (`NSO`, `PICID`, `REPORTCARD`, `CERTIFICATE_OF_TRANSFER`, `IDNO`) " _
                            & "VALUES ('" & Nyesno & "','" & Pyesno & "','" & Ryesno _
                            & "','" & Cyesno & "','" & txtStudentId.Text & "')"
                    create(sql)
                    'student basic info
                    sql = "INSERT INTO tblstudent(`IDNO`, `FNAME`, `LNAME`, `MNAME`, `SEX`, `BDAY`, `BPLACE`, `AGE`, `HOME_ADD`, `GUARDIAN`,`GUARDIAN_ADD`,`GUARDIAN_TEL`,`LASTSCHOOLATTEND`,`HEIGTH`,`WEIGTH`) " _
                            & "VALUES ('" & txtStudentId.Text & "','" & txtFName.Text & "','" & txtLName.Text & "','" & txtMName.Text _
                            & "','" & radioSEX & "','" & dtpDbirth.Text & "','" & txtPBirth.Text & "','" & txtAge.Text & "','" _
                            & txtAddress.Text & "','" & txtguardian.Text & "','" & txtguardianadd.Text & "','" & txtguardiantel.Text _
                            & "','" & txtLastSchoolAttend.Text & "','" & txtHeight.Text & "','" _
                            & txtWeigth.Text & "')"
                    messageTrue = "Student has been saved."
                    messageFalse = "Student Failed to save"
                    CreateUpdateDeleteAllMessage(sql, messageTrue, messageFalse)

                    sql = "UPDATE `autonumber` SET `STRT`=`STRT`+`INCREMENT` WHERE `ID`=1"
                    edit(sql)
                    ''''''''''''''''''''''''''''''
                    sql = "SELECT CONCAT(`NAME`, `STRT`) AS 'AUTO' FROM `autonumber` WHERE `ID`=1"
                    filltxtAuto(sql, txtStudentId)

                End If
                Return
            End If

        Next

    End Sub
    Private Sub txtLName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLName.TextChanged
        Try
            If IsNumeric(txtLName.Text) Then
                txtLName.Clear()
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub txtFName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFName.TextChanged
        Try
            If IsNumeric(txtFName.Text) Then
                txtFName.Clear()
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub txtMName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMName.TextChanged
        Try
            If IsNumeric(txtMName.Text) Then
                txtMName.Clear()
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub txtAge_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAge.TextChanged
        Try
            If Not IsNumeric(txtAge.Text) Then
                txtAge.Clear()
            End If
        Catch ex As Exception

        End Try

    End Sub

    Private Sub txtWeigth_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtWeigth.TextChanged

        Try
            If Not Double.Parse(IsNumeric(txtWeigth.Text)) Then
                txtWeigth.Clear()
            End If
        Catch ex As Exception

        End Try

    End Sub

    Private Sub txtHeight_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtHeight.TextChanged
        Try
            If Not Double.Parse(IsNumeric(txtHeight.Text)) Then
                txtHeight.Clear()
            End If
        Catch ex As Exception

        End Try

    End Sub

End Class