How do i make a label display if the textbox value that was entered is invalid?
This is my code so far and when i press the button to find the invaild source the label is suppose to appear but nothing is happening when i click the button.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


End Sub

    Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Click
        'Finds the employee associated with the employee ID entered by the user

        If txtUpdateID.Text = False Then
        End If
    End Sub

Recommended Answers

All 2 Replies

If Enflbl is a label in your form then you should use Enflbl.visible = true to show it and Enflbl.visible = false to hide it.

If txtUpdateID.Text = False Then

Will never work because you are comparing a string to a boolean. The short form of showing/hiding a label depending on a comparison is

Enflbl.Visible = txtUpdateID.Text = "some string value"

If txtUpdateID.Text is equal to the string value then the label is shown, otherwise it is hidden.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.