'What Event Handler should I use to change label
I am trying write a code so that once the value entered in the txtInput (textbox) is changed, the following labels lblName, lblPrice, lblSize would be should be cleared.
So far what I have isn't working as it automatically clears the label when I click in the textbox.
Private Sub txtbPrice_Enter(sender As Object, e As EventArgs) Handles txtbModelPrice.Enter
lblPrice.Text = ""
lblName.Text = ""
lblSize.Text = ""
End Sub
Solution 1:[1]
Neither the Validating nor Validated event is appropriate. Validating is where you validate the current control, i.e. txtbModelPrice in this case. The Validated event is for code you only want executed when validation is successful. If you're not handling Validating then you shouldn't handle Validated. In your case, you want code executed when txtbModelPrice loses focus, so you should handle the Leave event. All three events will work but they are intended for different purposes so you should use the one intended to be used.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user18387401 |
