none
age validation RRS feed

  • Question

  • Sorry I'm just a beginner, I want to validate the minimum age to be qualified you help me with that?

    Friday, September 28, 2018 8:31 AM

Answers

  • Hi,

    try the code:

        Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    
            If Not String.IsNullOrEmpty(TextBox1.Text) Then
                If CInt(TextBox1.Text) < 5 Then
                    MsgBox("error")
                    TextBox1.Clear()
    
                End If
            End If
    
    
        End Sub

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by no[one] Friday, September 28, 2018 11:07 AM
    Friday, September 28, 2018 9:25 AM

All replies

  • Hi,

    You will need to provide more details to help you resolve this issue.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, September 28, 2018 8:38 AM
  • sorry, for example if the value of the textbox is less than 5, the form will display an error icon
    Friday, September 28, 2018 8:51 AM
  • Hi,

    try the code:

        Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    
            If Not String.IsNullOrEmpty(TextBox1.Text) Then
                If CInt(TextBox1.Text) < 5 Then
                    MsgBox("error")
                    TextBox1.Clear()
    
                End If
            End If
    
    
        End Sub

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by no[one] Friday, September 28, 2018 11:07 AM
    Friday, September 28, 2018 9:25 AM