TabControl and GetType()
-
Hi, I am trying to get the FieldInfo for my TabControl. In particular I am interested in EVENT_SELECTEDINDEXCHANGED. I have method to which I am passing my TabControl object, and it's a "target" variable.
targetType = target.GetType();
FieldInfo[] fields = targetType.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);Now I am trying to see if any of the fields in the fieldinfo array contains EVENT_SELECTEDINDEXCHANGED. Any help is appreciated. Thank you
-
Hi, I am trying to get the FieldInfo for my TabControl. In particular I am interested in EVENT_SELECTEDINDEXCHANGED. I have method to which I am passing my TabControl object, and it's a "target" variable.
targetType = target.GetType();
FieldInfo[] fields = targetType.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);Now I am trying to see if any of the fields in the fieldinfo array contains EVENT_SELECTEDINDEXCHANGED. Any help is appreciated. Thank you
SelectedIndexChanged is an event, not a field. So if you're trying to get info about it using reflection, use
GetEvents
-method (or if you already know the event, GetEvent)instead ofGetFields
.The need to optimize rises from a bad design. My articles[^]