ComValue.SetValueFromEnum

Sets the ComValue structure to the specified Enum value.

Use this implementation instead of wwDotnetBridge::GetEnumValue() when the property, method or constructor has multiple overloads and the type conversion from enum to integer of GetEnumValue() won't find the correct member signature in .NET (Method not found error for example).

Using the COM value allows you to pass the actual Enum rather than the constant that identifies it and so the call can find the exact .NET signature.

o.ComValue.SetValueFromEnum(string enumType, string enumKeyName)

Parameters

string enumType
The base type of the enumerated value. (System.Windows.Forms.MessageBoxIcon)

string enumKeyName
The actual enum value name. (OK)

Example

*** Main object we're working with
loWager = loProxy.oBridge.CreateInstance("WageringService.Wager")

*** Use ComValue object to hold the Enum value
LOCAL loBoxType as Westwind.WebConnection.ComValue
loBoxType = loBridge.CreateInstance("Westwind.WebConnection.ComValue")

*** Get the static Enum Value and assign to ComValue
loBoxType.SetValueFromEnum("WageringService.BoxTypes","Square")

*** Pass ComValue object to InvokeMethod
loBridge.InvokeMethod(loWager,"SetBoxType",loBoxType)    

See also:

Class ComValue

© West Wind Technologies, 2004-2020 • Updated: 12/22/16
Comment or report problem with topic