I want to know how to change the color of a label using its code, something like:
dim r as color
r = color.red
How do I use or assign that code to a label from a button...? Like in my form button and a label.. when the button is clicked the label changes its color .. how do I do that in vb.net?.
Here is my button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim r As Color
r = Color.Red
End Sub
End Class
??
You have defined a variable which is not the right way to do it. A label exposes some properties and to achieve your goal you simply do this:
Label1.BackColor = Color.Aqua
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With