J
John
Hi
I am using the below code to get properties and then sub properties on an
object;
Dim Prop As PropertyDescriptor
Dim Props As PropertyDescriptorCollection
Props = TypeDescriptor.GetProperties(Ctrl)
For Each Prop In Props
Dim PropObject As Object = Prop.GetValue(Ctrl)
Dim converter As TypeConverter = TypeDescriptor.GetConverter(PropObject)
...
Next
Unfortunately the PropObject comes out as nothing for Ctrl =
{System.Windows.Forms.BindingNavigator}on line Dim PropObject As Object =
Prop.GetValue(Ctrl) and this gives 'System.ArgumentException was unhandled'
error on the line Dim converter As TypeConverter =
TypeDescriptor.GetConverter(PropObject). How can I get round this problem?
The value of prop when this error came as per watch is given below.
Thanks
Regards
- Prop {System.ComponentModel.ReflectPropertyDescriptor}
System.ComponentModel.PropertyDescriptor
+ System.ComponentModel.ReflectPropertyDescriptor
{System.ComponentModel.ReflectPropertyDescriptor}
System.ComponentModel.ReflectPropertyDescriptor
+ Attributes {System.ComponentModel.AttributeCollection}
System.ComponentModel.AttributeCollection
Category "Behavior" String
+ ComponentType {Name = "Control" FullName =
"System.Windows.Forms.Control"} System.Type
+ Converter {System.ComponentModel.ComponentConverter}
System.ComponentModel.TypeConverter
Description "The shortcut menu to display when the user right-clicks the
control." String
DesignTimeOnly False Boolean
DisplayName "ContextMenuStrip" String
IsBrowsable True Boolean
IsLocalizable False Boolean
IsReadOnly False Boolean
Name "ContextMenuStrip" String
+ PropertyType {Name = "ContextMenuStrip" FullName =
"System.Windows.Forms.ContextMenuStrip"} System.Type
SerializationVisibility Visible {1}
System.ComponentModel.DesignerSerializationVisibility
SupportsChangeEvents True Boolean
I am using the below code to get properties and then sub properties on an
object;
Dim Prop As PropertyDescriptor
Dim Props As PropertyDescriptorCollection
Props = TypeDescriptor.GetProperties(Ctrl)
For Each Prop In Props
Dim PropObject As Object = Prop.GetValue(Ctrl)
Dim converter As TypeConverter = TypeDescriptor.GetConverter(PropObject)
...
Next
Unfortunately the PropObject comes out as nothing for Ctrl =
{System.Windows.Forms.BindingNavigator}on line Dim PropObject As Object =
Prop.GetValue(Ctrl) and this gives 'System.ArgumentException was unhandled'
error on the line Dim converter As TypeConverter =
TypeDescriptor.GetConverter(PropObject). How can I get round this problem?
The value of prop when this error came as per watch is given below.
Thanks
Regards
- Prop {System.ComponentModel.ReflectPropertyDescriptor}
System.ComponentModel.PropertyDescriptor
+ System.ComponentModel.ReflectPropertyDescriptor
{System.ComponentModel.ReflectPropertyDescriptor}
System.ComponentModel.ReflectPropertyDescriptor
+ Attributes {System.ComponentModel.AttributeCollection}
System.ComponentModel.AttributeCollection
Category "Behavior" String
+ ComponentType {Name = "Control" FullName =
"System.Windows.Forms.Control"} System.Type
+ Converter {System.ComponentModel.ComponentConverter}
System.ComponentModel.TypeConverter
Description "The shortcut menu to display when the user right-clicks the
control." String
DesignTimeOnly False Boolean
DisplayName "ContextMenuStrip" String
IsBrowsable True Boolean
IsLocalizable False Boolean
IsReadOnly False Boolean
Name "ContextMenuStrip" String
+ PropertyType {Name = "ContextMenuStrip" FullName =
"System.Windows.Forms.ContextMenuStrip"} System.Type
SerializationVisibility Visible {1}
System.ComponentModel.DesignerSerializationVisibility
SupportsChangeEvents True Boolean