Click here to Skip to main content
12,448,720 members (52,930 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB Color graphics
Hi I have make a Custom Color Picker and made a combo box so the names of the colors appear in it, how can I make a messagebox appear after selecting the color in the combobox

Also im trying to store that color into the databse with an insert is there anyway to do it

Below is my code for displaying the colors in the ComboBox

Private Sub frmRegAsam_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'load de colores'
      Dim ColorList As New ArrayList()
      Dim colorType As Type = GetType(System.Drawing.Color)
      Dim propInfoList As PropertyInfo() = colorType.GetProperties(BindingFlags.[Static] Or BindingFlags.DeclaredOnly Or BindingFlags.[Public])
      For Each c As PropertyInfo In propInfoList
  End Sub
Posted 26-Mar-13 10:52am
Sergey Alexandrovich Kryukov 26-Mar-13 17:34pm
System.Windows.Forms? Tag: "WinForms".
What's the problem, exactly? You are not trying to work with the database in this code sample.
ThePhantomUpvoter 26-Mar-13 20:32pm
Why can you not create a combobox selection changed event? Are you unable to show a messagebox? If your "problem" is either the first or the second, why did you post code for something that has nothing to do with either? And there is no indication that you have tried anything with a database, as stated by Sergey. So what does a database have to do with the code you posted?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

1. Use the combobox selected index change event to trap the event.
2. Create function called display color
3. Function DisplayColor should display a new form with the background set to the combobox selected value

It will be easier to create your own form rather use a messagebox object.

If you want to save the selected values to the database then just insert into a table the colorname you added to the combobox.

I am assuming you need other fields in there like userid perhaps, to fetch user preferences.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 27 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100