I have a generic user control:
public partial class SearchBoxGeneric<T> : UserControl where T : class
{
private T value;
public virtual T Value
{
get {return this.value;}
set {set this.value = value}
}
}
And I have a number of user controls that inherit from this base control, overriding Value
property.
I loop through the form's controls and get the value based on the control type:
for (Control c in this.Controls
{
switch (c.GetType().Name)
{
case "TextBox":
//Do something...
break;
}
}
But how can I get the value of the generic user controls?