Hi, I have a form with some labels. If the labels equal certain text, then I want the font size of the label to change. For example, if the text reads "apple", I want the font size of the label to be 16. If the text reads "banana", I want the font size of the label to be 8. This has to occur during runtime without any clicking of the label. I have an idea of the code I want to write in order for this to work, but I need to know where to put the code for the labels. I cannot put this under Label_Click or Form_Load. Where can I put this code so that it works for the labels during runtime? Thank you in advance. I have VB2008.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text.Contains("apple") Then
Label1.Font = New Font(Label1.Name, 16)
End If
If TextBox1.Text.Contains("banana") Then
Label1.Font = New Font(Label1.Name, 8)
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text.Contains("apple") Then
Label1.Font = New Font(Label1.Name, 16)
End If
If TextBox1.Text.Contains("banana") Then
Label1.Font = New Font(Label1.Name, 8)
End If
End Sub