How to use ColorDialog in

The following example shows the usage of the colordialog class in

The example shows that how you can use the colordialog class to change the fore color of the label and textbox control. In this example, we use the LinkLabel1_LinkClicked event procedure to display the color dialog.

Change the color of the label and textbox
ColorDialog in


    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, _
                                       ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) _
                                       Handles LinkLabel1.LinkClicked
        Dim objColorDlg As New ColorDialog
        If objColorDlg.ShowDialog = Windows.Forms.DialogResult.OK Then
            Label1.ForeColor = objColorDlg.Color
            TextBox1.ForeColor = objColorDlg.Color
        End If
    End Sub