Windows Develop Bookmark and Share   
 index > Windows Forms Designer > DefaultValue attribute VC++ definition not working
 

DefaultValue attribute VC++ definition not working

It could just be my usage but I can't get the DefaultValue designer attribute to work for colors in vc++/vs2005.

I'm defining as follows.

public:

[System::ComponentModel::DefaultValue(System::Drawing::Color::typeid, "Orange")]

property System::Drawing::Color MyComponentColor;

When I add the control to my form it correctly displays in the designer with the exception that the MyComponentColor property is not set to Orange as I would have expected. I've seen plenty of VB & C# examples of this which all claim to work and I believe I have correctly converted them to VC++ above...? Anyone able to lend a hint at what I've done wrong?

Thanks

tyler000  Saturday, November 11, 2006 7:50 AM
It would appear that a namespace conflict was causing the value not to be properly set. Thanks for looking, problems already solved.
tyler000  Saturday, November 11, 2006 8:20 AM
It would appear that a namespace conflict was causing the value not to be properly set. Thanks for looking, problems already solved.
tyler000  Saturday, November 11, 2006 8:20 AM

You can use google to search for other answers

Custom Search

More Threads

• OLE calling and STAThread
• need suggestion
• Using interface as a property type?
• Adding code to VS 2005 generated windows form.
• how to create a textbox by clicking a button
• How to do this...in vs 2005??
• Help on MSHTML based editor
• Incorrect Serialization of Collection property in IExtenderProvider
• Custom Control and Designer Refresh issues
• How does ListBox paint in design mode?