[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Variants' (#rtl)

# SetVariantProp

Set variant valued property

## Declaration

Source position: variants.pp line 349

`procedure SetVariantProp(`
`Instance: TObject;`
`const PropName: string;`
`const Value: Variant`
`); procedure SetVariantProp(`
`Instance: TObject;`
`PropInfo: PPropInfo;`
`const Value: Variant`
`);`

## Arguments

`Instance` |  | Instance on which to set the variant property
`PropName` |  | Name of the property to set
`Value` |  | Value to set property to.

## Arguments

`Instance` |  | Instance on which to set the variant property
`PropInfo` |  | Pointer to property description (RTTI)
`Value` |  | Value to set property to.

## Description

SetVariantProp sets the value of the variant-types property described by PropInfo or PropName from the Instance to Value.

This function is used as the value for the TypInfo unit's OnSetVariantProp callback. This callback is automatically initialized with the function when the variants unit is used.

## See also

TypInfo |  | Access Run-Time Type Information (RTTI)
TypInfo.OnSetVariantProp |  | Callback to set a variant property value.
GetVariantProp |  | Get variant valued property
GetPropValue |  | Return a property value as a variant