ColorDialog Control in Visual Basic .NET

August 25, 2017

If you want to change the color in your Form, TextBox, Label etc at the runtime you can use ColorDialog control

The ColorDialog control allows you to select color from its basic 48 colors

Now I will program the following form to change the color of the Label

This is the code to change the color of the Label

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Label1.ForeColor = ColorDialog1.Color
        End If

    End Sub
End Class