While other people have correctly indicated what the problem is, I just want to hear that it will be quite suitable for the extension method. Do not push this up, this is actually a comment, I just post it as an answer in order to be able to write longer and format the code better;)
public static class Extensions { public static T FindControl<T>(this Control parent, string id) where T : Control { return item.FindControl(id) as T; } }
So that you can call it like this:
Label myLabel = MainForm.Controls.FindControl<Label>("myLabelID");
source share