wwDotNetBridge::GetEnumValue

Retrieves a .NET Enumerated value by passing in a string representation and retrieving the corresponding numeric value.

Note that VFP Intellisense (if available) can also furnish this value to you directly as a numeric value which is more efficient. But this only works if the type is registered for COM Interop (most are not) and when you have it referenced explicitly in your code as the COM type using a LOCAL declaration.

o.GetEnumValue(lcType, lcValue)

Return Value

Numeric value of the enum value

Parameters

lcType
The fully qualified enumerated type. This is the more efficient syntax. (System.Windows.Forms.MessageBoxIcon)

If lcValue is not passed the type is assumed to be the full Enum type name including the enumeration property name. (System.Windows.Forms.MessageBoxIcon.Exclamation)

lcValue
The enum value as a string.

Remarks

If calling methods that are overloaded, the ordinal values returned from this function may not work because the value doesn't match the parameter signature exactly. If that's the case use a ComValue.SetEnum() instead and pass that in place of the enum value.

Example

? loBridge.GetEnumValue("System.Windows.Forms.MessageBoxDefaultButton.Button2")  && 256

*** Slightly more efficient - treated like a pure static
loBridge.GetEnumValue("System.Windows.Forms.MessageBoxDefaultButton","Button3")  && 512

See also:

Class wwDotNetBridge

© West Wind Technologies, 2023 • Updated: 06/07/17
Comment or report problem with topic