VB.NET Language Pocket Reference
1.14 Other Conversion
Fix Function | Microsoft.VisualBasic.Conversion |
Fix(number) |
number required; Double or any numeric expression
A number whose integer portion is to be returned
Return Value
A number of the same data type as number whose value is the integer portion of number
Description
For nonnegative numbers, Fix returns the floor of the number (the largest integer less than or equal to number). For negative numbers, Fix returns the ceiling of the number (the smallest integer greater than or equal to number). If number is Nothing, Fix returns Nothing.
The operation of Int and Fix are identical when dealing with positive numbers: numbers are rounded down to the next lowest whole number. For example, both Int(3.14) and Fix(3.14) return 3. If number is negative, Fix removes its fractional part, thereby returning the next greater whole number. For example, Fix(-3.667) returns -3. This contrasts with Int, which returns the negative integer less than or equal to number (or -4, in the case of our example).
Hex Function | Microsoft.VisualBasic.Conversion |
Hex(number) |
number required; Numeric or String
A valid numeric or string expression
Return Value
String representing the hexadecimal value of number
Description
Converts a number to its hexadecimal (base 16) equivalent. If number contains a fractional part, it will be automatically rounded to the nearest whole number before the Hex function is evaluated. number must evaluate to a numeric expression that ranges from -2,147,483,648 to 2,147,483,647. If the argument is outside of this range, an exception results. The return value of Hex is dependent upon the value and type of number:
number | Return value |
Nothing | Zero (0) |
Any other number | Up to eight hexadecimal characters |
Int Function | Microsoft.VisualBasic.Conversion |
Int(number) |
number required; any valid numeric data type
The number to be processed
Return Value
Returns a value of the data type passed to it
Description
Returns the integer portion of a number. The fractional part of number is removed, and the resulting integer value is returned. Int does not round number to the nearest whole number. For example, Int(100.9) returns 100. If number is negative, Int returns the first negative integer less than or equal to number. For example, Int(-10.1) returns -11.
Oct Function | Microsoft.VisualBasic.Conversion |
Oct(number) |
number required; Numeric or String
A valid numeric or string expression
Return Value
String
Description
Returns the octal value of a given number. If number is not already a whole number, it is rounded to the nearest whole number before being evaluated. If number is Nothing, an error occurs. Oct returns up to 11 octal characters.
QBColor Function | Microsoft.VisualBasic.Information |
QBColor(color) |
color required; Integer
A whole number between 0-15
Return Value
Long
Description
Returns a Long integer representing the RGB system color code. color can have any of the following values:
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 |
RGB Function | Microsoft.VisualBasic.Information |
RGB(red, green, blue) |
red required; Integer
A number between 0 and 255, inclusive
green required; Integer
A number between 0 and 255, inclusive
blue required; Integer
A number between 0 and 255, inclusive
Return Value
An Integer representing the RGB color value
Description
Returns a system color code that can be assigned to object color properties. The RGB color value represents the relative intensity of the red, green, and blue components of a pixel that produces a specific color on the display. The RGB function assumes any argument greater than 255 to be 255.
The following table demonstrates how the individual color values combine to create certain colors:
Color | Red | Green | Blue |
Black | 0 | 0 | 0 |
Blue | 0 | 0 | 255 |
Green | 0 | 255 | 0 |
Red | 255 | 0 | 0 |
White | 255 | 255 | 255 |