Results 1 to 6 of 6

Thread: Color in a ComboBox?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    West Hartford, CT, USA
    Posts
    42

    Post

    Is it possible to assign different colors to the different items in a combo box?

    Thanks


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    It is if you use Subclassing with the Windows API, for examples, check out my previous answers for a Colored Combobox and a Colored Listbox.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    West Hartford, CT, USA
    Posts
    42

    Post

    The colors work ok, but when I unload, I get a "vb 6 has performed an illegal operation".

    I have the following lines in my unload event:

    'Release the SubClassing, Very Import to Prevent Crashing!
    Call SetWindowLong(hwnd, GWL_WNDPROC, lPrevWndProc)

    Any ideas?



    [This message has been edited by Andrew Herrmann (edited 12-30-1999).]

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    When Subclassing you need to make sure you close the Form properly, don't just hit Stop on the VB Navigation Bar, otherwise the Subclassing Release Code Never Executes causing the GPF.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]



    [This message has been edited by Aaron Young (edited 12-30-1999).]

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    West Hartford, CT, USA
    Posts
    42

    Post

    I have a button on my form which when pressed does the following:

    unload me

    I've verified that my unload event is being triggered (by placing a msgbox inside of it).

    Is there a different way that I should be doing this?

  6. #6
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Did you copy and Paste the Code I posted Exactly, maybe you declared lPrevWndProc Privately and are using a Zero value, when Removing the Subclassing.

    If you create a new project, add a Combobox and set the Startup Object to Sub Main and Paste the Code I posted Exactly, it will work.

    If you can't get it to work, post your code and I'll take a look.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width