Dynamically change label text

bullsquad

Member
Joined
Apr 8, 2010
Messages
6
Programming Experience
3-5
Hello,

Is there a way to change label text at run time?. I don't want to annoy users with popup. So planning to display error in a label if its text could be changed.

So far I have included a Main Form which has a label lblErrorFeedback which is not visible initially and I have done this but does not work.

lblErrorFeedback.Visible = True
lblErrorFeedback.Text = ""
lblErrorFeedback.TextAlign = ContentAlignment.MiddleRight
lblErrorFeedback.Text = "Error Occured"


Is there a better way to show the error with out popups?

Thanks in advance
 
BS,

Is this what you are looking for?

Private Sub CheckError()
Dim Error As Boolean

If Error = True Then
lblErrorFeedback.Visible = True
lblErrorFeedback.Text = "Error Detected!"
lblErrorFeedback.BackColor = Color.Red

ElseIf Error = False Then
lblErrorFeedback.Visible = False
End If
End Sub

Best regards,

David
 
Back
Top