I am using attributes to define the Description, Category and Display name of properties that populate a PropertyGrid (within a CollectionEditor).
Is there any way to modify these attributes at run time such that they display different values? For instance, one of my properties is Temperature, for which I would like the Description to display "Enter temperature (°C)" if the user has selected one unit system and "Enter temperature (°F)" if a different unit system is selected.
Code for the property is shown below:
If this is not possible, is there another way of achieving the same effect?
Many thanks for any help.
Is there any way to modify these attributes at run time such that they display different values? For instance, one of my properties is Temperature, for which I would like the Description to display "Enter temperature (°C)" if the user has selected one unit system and "Enter temperature (°F)" if a different unit system is selected.
Code for the property is shown below:
<DescriptionAttribute("Enter temperature (°C)."), _
CategoryAttribute("Physical properties"), _
DisplayName("Temperature")>
Property Temperature As Double
Get
Return myTemperature
End Get
Set(ByVal value As Double)
myTemperature = value
End Set
End Property
If I try and put a variable in the argument to DescriptionAttribute I get a 'Constant expression is required' error.If this is not possible, is there another way of achieving the same effect?
Many thanks for any help.