I ad开发者_运维知识库ded Designer support for my control.
I got the following exception when setting the property value like below.
var colStyle = visibleColumn.Properties["PropertyName"].SetValue(Value);
The same above code works fine for VS 2010 project
but it shows the following exception for VS 2008 project
InnerException: System.Reflection.AmbiguousMatchException Message="Ambiguous match found." Source="mscorlib"
Just a wild guess, but this may be due to a derived class having a property that is hiding the base class implementation, confusing the reflection mechanism.
If you use GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).SetValue(target, value, null)
it may fix the problem.
精彩评论