This is not possible as the attribtue is compiled into the metadata for the
assembly and it cannot be modified at runtime.
Is this just to get the property grid value to not be bold when the value
isnt 20K.?
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"RedLars" wrote:
> This code set an employee's salary to £20,000 by default. I'd like to
> set this at runtime, i.e. let the variable _recommendSalary be the
> default value.
>
> public class Employee
> {
> private string _Name = "";
> private int age = 0;
> private string _Position = "";
> private string _Salary = "";
> private string _recommendSalary = "£22,000";
> private string[] _SalaryOption = { "£20,000", "£25,000",
> "£30,000", "£40,000" };
>
> [DefaultValueAttribute("£20,000")]
> public string Salary { ... }
> // properties to access member values
> }
>
> Been looking at this for a while but unsure which method that would
> handle such a property. I have both an EmployeeCollection class that
> implements ICustomTypeDescriptor and
> EmployeeCollectionPropertyDescriptor that inherets from
> PropertyDescriptor.
>
> Appreciate any input.
>
>