I am using C# and a very old version of .Net. I have hundreds of forms and a class. Each form has a ProcessDump() method. When a form is opened, its controls are passed to my class. I need to call ProcessDump method and all i have is controls of the form. How can I access to the method?
Share
Have each form implement an interface called
IProcessDump:Assuming WinForms, there is the
FindFormmethod going back to .NET 1.1. Grab the form and test it for the interface:Alternatively, controls have a
Parentproperty. For controls placed directly on the form the parent will be the form:The null check might not be required.