QBColor Function

Named Arguments

No

Syntax

QBColor(color)

color

Use: Required

Data Type: Integer

A whole number between 0–15.

Return Value

A Long integer.

Description

Returns a long integer representing the RGB system color code.

Rules at a Glance

color has the following settings:

Number Color
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Yellow
7 White
8 Gray
9 Light Blue
10 Light Green
11 Light Cyan
12 Light Red
13 Light Magenta
14 Light Yellow
15 Bright White

Programming Tips and Gotchas

  • The RGB function allows much more flexibility than the older QBColor function, which is a remnant of QBasic.

  • Visual Basic now contains a wide range of intrinsic color constants that can assign colors directly to color properties of objects.

See Also

RGB Function

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.