Dialog box to select a color (ColorDialog)

Example very, very easy on the use of the dialog box to select colors in visual basic. Net.

We just need a form, a button and a ColorDialog component for this example. and in the click event of BotCon copy the following code:

 Then if ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK
       Me.BackColor = ColorDialog1.Color
 End If

The result is shown in the image below.

Hope this helps.

8 Responses to "dialog box to select a color (ColorDialog)"

  1. Information Bitacoras.com ...

    Rate in Bitacoras.com: Example very, very easy on the use of the dialog box to select colors in visual basic. Net. We just need a form, a button and a ColorDialog component for this example. and in the event c ....

  2. Jose says:

    good tip, but as it is to open a dialog box like the backcolor property of a textbox for example?

  3. Jose says:

    I mean you can select solid colors, website or system. of the same style properties backcolor

  4. [...] This example arose from a query in this article. [...]

  5. lupita says:

    hello friend eliseo

    I program in c but now I have a problem with vb

    quisier know how I can change the background color of cells in a datagridview
    instead of the bottom of the form

    • Elisha says:

      Try this:

      Me.dataGridView1.DefaultCellStyle.BackColor = Color.Beige
      or siquieres do this alone in a cell:
      Me.dataGridView1.Rows (3). DefaultCellStyle.BackColor = Color.Beige

      Luck

  6. lupita says:

    Thanks friend but not exactly what I want ...

    I need to color the selected cell of the datagridview (single cell) with a ColorDialog

    or at least one default button already has a color
    thanks and hope you can help me

Comment