VariantIDiv
f90VB Modules
f90VBDefs, f90VBVariants
Summary
Returns the result from dividing two variants after they have been converted to integer types.
Syntax
| type(VARIANT) function VariantIDiv | (VarLeft, VarRight, iRet) |
| type(VARIANT),intent(in):: | VarLeft |
| type(VARIANT),intent(in):: | VarRight |
| integer(HRESULT_KIND),intent(out),optional:: | iRet |
Arguments
VarLeft and VarRight [Input]
Two variant values. Must be initialized variants.
iRet [Output/Optional]
Upon return, iRet contains S_OK or an error code. See comments for more information.
Comments
The function divides the two provided variants after converting them into equivalent integer expressions using the following rules:
| If: | Function returns a: | |
| Both expressions are of the string, date, character, Boolean type | Division | |
| One expression is a string type and the other a character | Division | |
| One expression is numeric and the other is a string | Division | |
| Both expressions are numeric | Division | |
| Either expression is NULL | Null variant | |
| VarRight is empty and VarLeft is anything but empty | DISP_E_DIVBYZERO | |
| VarLeft is empty and VarRight is anything but empty | Zero(0) of double subtype | |
| Both expressions are empty | DISP_E_OVERFLOW | |
Argument iRet
Indicates success or failure of the subroutine. The following codes can be returned in this argument:
| Value returned in argument iRet | Description | |
| S_OK | Success. | |
| DISP_E_BADVARTYPE | One or both of the passed variant types are not a valid type of variant. | |
| DISP_E_TYPEMISMATCH | At least one of the variants could not be coerced to the appropriate type for this operation. | |
| E_INVALIDARG | One of the arguments is invalid. | |
| E_OUTOFMEMORY | Memory could not be allocated for the operation.. | |
Examples
See example for VariantAdd.
Related Topics
| For information about: | See: | |
| Variant multiplication | VariantMul | |
| Variant division | VariantDiv | |