I am programming in C#
WinForms
. I want to know, how can I find any controls that has DataSource
property, also DisplayMember
and ValueMember
properties?
What is that controls base class? is it Control
class or what?
I want to have a method to return a "Control" base object, that has all 3 DataSource
, DisplayMember
and ValueMamber
properties.
So I'll can assign a ComboBox
or ListBox
to that return object. For example:
public myReturnType GetControl()
{
//Some Code Here
...
return myReturnType;
}
ComboBox a = GetControl();
ListBox b = GetControl();
...
After that assignment, both a
and b
controls, has desire DataSourse
, DisplayMember
and ValueMember
properties.
Usually they are derived from base class ListControl which has all three properties defined in Base. So you can check if a control is of type ListControl it will have all three properties.
If you want to investigate such information simply press F12
or use Right click
and GoToDefinition
for any class and look for base classes and other information for builtin types.