ComValue.SetValueFromStaticProperty
less than 1 minute to read

Sets the value property from a static property retrieved from .NET. Useful to transfer value in .NET that are marshalled incorrectly in FoxPro such as Enum values (that are marshalled as numbers)

public void SetValueFromStaticProperty(string typeName,
	string property);

Parameters

typeName
Full type name as a string - can also be an Enum type

property
The static property name

Example

foxpro
*** Main object we're working with loWager = loProxy.oBridge.CreateInstance("WageringService.Wager") *** Want to assign to Modifier property of type Nullable<WagerModifier> *** which is an Enum value (ie. static field value). Normally Enums *** work as numbers but because it's of Nullable<T> the EXACT *** Enum type is required *** Use ComValue object to hold the Enum value LOCAL loComValue as Westwind.WebConnection.ComValue loComValue = loBridge.CreateInstance("Westwind.WebConnection.ComValue") *** Get the static Enum Value and assign to ComValue loComValue.SetValueFromStaticProperty("WageringService.WagerModifier","Box") *** Pass ComValue object to SetProperty to assign (or in InvokeMethod()) loBridge.SetProperty(loWager,"Modifier",loComValue)

See also:

Class ComValue

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