Creating color dialog box in VB.NET

This article shows how to create a color dialog box in VB.NET windows forms application.
  • 5183

In this article we will learn about the color and font dialog control in window application in VB.NET.

Color Dialog

To provide the Color dialog box to your application on the Toolbox, you can click the ColorDialog button and click anywhere on the form. The Color dialog box is implemented through the ColorDialog class.

FullOpen property:

You can control the regular or full size of the dialog using the Boolean FullOpen property. When its value is False, which is the default, the dialog appears regularly. If you want it to appear in its full size, set this property to True.


To display the dialog box to the user, call the ShowDialog() method.

For example:

click the ColorDialog button from toolbox and take two control text box and button to the form and make the multiline textbox.



Now, double click on the button named color in the form and write the following code.

Private Sub cmdColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdColor.Click

        ColorDialog1.FullOpen = True


        textBox4.ForeColor = ColorDialog1.Color

    End Sub

Now press Ctrl+F5 to run the application.

The below window will appear and we write some text on the text box and than and then click on the button named color.


 Now select the color from the color box and click on the button OK and color will display on the textbox.

We choose color red from the color box and click on the button OK. textbox text will display as shown below.



More Articles

© 2020 DotNetHeaven. All rights reserved.