VB pop color picker
I have a question of VB event handler and color picker.
Now I have a label, and I want when user click it, it pops up a color picker dialog and let user to change the background color of the label.
Not sure how to implement this, can anyone give me a direction?
Use the .NET Framework's
ColorDialog class in your
Label's click handler.
Private Sub Label1_Click(ByVal sender As Object, ByVal e As EventArgs) _ Handles Label1.Click Dim cDialog As New ColorDialog() cDialog.Color = Label1.BackColor ' initial selection is current color. If (cDialog.ShowDialog() = DialogResult.OK) Then Label1.BackColor = cDialog.Color ' update with user selected color. End If End Sub