Microsoft KB Archive/185090

= How To Create Multicolored Items in a Combo Box =

Article ID: 185090

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q185090



SUMMARY
This article illustrates how you can create multicolored items in a combo box using Visual FoxPro versions 3.x and 5.x.



MORE INFORMATION
To create multicolored items in a combo box, the setting of the combo box RowSourceType has to be 9-popup and the RowSource property has to be set to the name of the popup.

The following steps illustrate how to accomplish this:

 Create a form.  Place in the following code in the INIT event of the form: #DEFINE RedBar ,RGB(150,0,0) #DEFINE GreenBar ,RGB(0,150,0) #DEFINE BlueBar ,RGB(0,0,255) #DEFINE YellowBar ,RGB(255,255,0)

DEFINE POPUP MultiColor

DEFINE BAR 1 of MultiColor ; Prompt "Red" COLOR RedBar

DEFINE BAR 2 of MultiColor ; Prompt "Green" COLOR GreenBar

DEFINE BAR 3 of MultiColor ; Prompt "Blue" COLOR BlueBar

DEFINE BAR 4 of MultiColor ; Prompt "Yellow" COLOR YellowBar   Add a Combo box object to the form and set the following properties: RowSourceType = 9 - popup RowSource = "MultiColor" (without quote)   In the InteractiveChange event of the combo box, place the following code: DO CASE CASE This.Value = "Red" This.Forecolor = RGB(150,0,0) CASE This.Value = "Green" This.Forecolor = RGB(0,150,0) CASE This.Value = "Blue" This.Forecolor = RGB(0,0,255) CASE This.Value = "Yellow" This.Forecolor = RGB(255,255,0) ENDCASE  Save and run the form.

When the form is run, click the combo box drop-down list. The items in the drop-down list appear in their respective colors.

Additional query words: popup

Keywords: kbhowto KB185090

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.