• We just launched and are currently in beta. Join us as we build and grow the community.

ColorDialog Tutorial in VB.NET

sippimacxiii

Traffic Master
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
192
Likes
60
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
Color Dialog is one of the important features in VB.NET. It represents a common dialog box that displays available colors along with controls that enable the user to define custom colors.

Now, let's start this Color Dialog tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Next, add only one Button named Button1 and labeled it as "Change Background Color". Next, put a ColorDialog as a dialog box control in your toolbox.

colordesign.png


3. Add ColorDialog from the toolbox:

colordialog.png


4. Now put add this code for your code module. This code is for Button1_Click:
  1. Private

    Sub

    Button1_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button1.

    Click
  2. ColorDialog1.

    ShowDialog

    (

    )
  3. Me

    .

    BackColor

    =

    ColorDialog1.

    Color
  4. End

    Sub

Explanation:

ColorDialog1.

ShowDialog

(

)

- is our syntax for opening the color dialog box. It will look like this one when you click the button.

coloroutput1.png


When picking or choosing a color from the color dialog box, the background color of the from will change as we have the code Me

.

BackColor

=

ColorDialog1.

Color

. This means that the value of the color you choose in you colordialog will be equal to the background color of your form.

Now, click the Ok from your ColorDialog. It will change the back color of your form like this:

coloroutput2.png


Download the source code below and try it! :)

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,

Engr. Lyndon R. Bermoy

IT Instructor/System Developer/Android Developer

Mobile: 09079373999

Telephone: 826-9296

E-mail:[email protected]

Visit and like my page on Facebook at: Bermz ISware Solutions

Subscribe at my YouTube Channel at: SerBermz


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,526

323,535

Top