Getting the properties, attrs and evts of the control.


Imports System.ComponentModel Console.WriteLine("===============================");

///Getting the properties of a particular control.
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(checkBox1);

foreach(PropertyDescriptor p in properties){
Console.WriteLine(p.DisplayName +
" || " + p.Description);
}
Console.WriteLine("===============================");

///Getting the Attributes of a particular control.
AttributeCollection attributes =
TypeDescriptor.GetAttributes(checkBox1);

foreach (Attribute a in attributes) {
Console.WriteLine(a.TypeId);
}
Console.WriteLine("===============================");

///Getting the Attributes of a particular control.
EventDescriptorCollection events =
TypeDescriptor.GetEvents(checkBox1);

foreach (EventDescriptor evt in events) {
Console.WriteLine(evt.DisplayName);
}

There is another good way to get all properties, methods and events from assembly by using System.Reflection.I’ll post this coding as soon as possible. Please feel free to let me know if you have any problem with this coding.
Thanks. Enjoy reading!

Posted in C#

Leave a Reply

Your email address will not be published. Required fields are marked *