QBColor Function 

Returns an Integer value representing the RGB color code corresponding to the specified color number.

QBColor(Color)

Parameters

  • Color
    Required. A whole number in the range 0–15.

Settings

The Color argument has these settings.

Number Color Number Color

0

Black

8

Gray

1

Blue

9

Light blue

2

Green

10

Light green

3

Cyan

11

Light cyan

4

Red

12

Light red

5

Magenta

13

Light magenta

6

Yellow

14

Light yellow

7

White

15

Bright white

Exceptions

Exception type Error number Condition

ArgumentException

5

Color is outside of range 0 to 15, inclusive.

See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.

Remarks

Starting with the least-significant byte, the returned value specifies the red, green, and blue values used to set the appropriate color in the RGB system used by the Visual Basic language.

Example

This example uses the QBColor function to change to the color indicated by colorInteger. QBColor accepts integer values between 0 and 15.

Dim colorInteger As Integer
' Use 4 for red.
colorInteger = QBColor(4)

Requirements

Namespace: Microsoft.VisualBasic

Module: Information

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Reference

RGB Function (Visual Basic)
ArgumentException Class