265 of 286
251 To<enum> Type Function returning an Enum member Invocation To<enum>(val) Parameter Method Type Description val ByVal integral The value to convert to an Enum member. Discussion This page describes a set of functions that convert the given value to a member of a specific enumeration. For each enumeration that you define in your program the compiler automatically provides a conversion function whose name is the name of the enumeration with the prefix To. To use this conversion function, replace the <enum> portion of the function name as shown above with the actual enumeration name for which value-to-member conversion is desired. See below for an example of how this is done. See the section on enumerations for more information. Compatibility This function is provided for backward compatibility. It is recommended to use CType() for new applications. Example Enum Color Red Green Blue End Enum Dim c as Color c = ToColor(1) ' c will have the value Green See Also CType