Changing the value of a Attribute at run time

P

Pradeep

Hi,

Is it possible to conditionally change the value of the "Browsable"
attribute at the top of the property constructor at runtime in VC++.net?
For example, I would like to conditionally change the following property
(PartNumber) to display in a property grid. I can control whether it
displays by inserting either Browsable(True) or Browsable(False), but I
would like to do this programmatically based on a condition.

[Browsable(True)]
__property String* get_PartNumber()
{
return _partNumber;
}

__property void set_PartNumber(String* value)
{
_partNumber = value;
}

thanks,
Pradeep
 
Q

Quentin Pouplard

Pradeep said:
Hi,

Is it possible to conditionally change the value of the "Browsable"
attribute at the top of the property constructor at runtime in
VC++.net?
For example, I would like to conditionally change the following
property (PartNumber) to display in a property grid. I can control
whether it displays by inserting either Browsable(True) or
Browsable(False), but I would like to do this programmatically based
on a condition.

Not directly, but have a look to
System.ComponentModel.ICustomTypeDescriptor and friends. You should be
able to do what you want and even more. I think there is an article on
codeproject.com about that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top