DirectCast Function
Syntax
DirectCast (expr, objtype)
Group
Description
Returns the expr's type related to the objtype type. If a type does not exist, a "type mismatch error" will occur.
Parameters
| Parameter | Description |
|---|---|
| expr | Converts the value of this expression. |
| objtype | Converts to this type. |
Sub Main
Dim V As Object
V = Err
Debug.Print TypeName(DirectCast(V, ErrObject)) ' ErrObject
EndSub