Does any one know of any standards or white papers on how to accomplish the following:
I have a project with a form called myForm, and a single class called ClassA. Within ClassA I have a method called CreateButton, which creates an instance of Button Class via code. The question is: how do I add this Button object to the Controls collection since the ClassA does not have a reference to myForm?
I know that I could pass a reference to myForm to the constructor of ClassA, but I do not want this class to know anything about myForm. Basically I do not want that class to be coupled with the form.
I know I could use a delegate to accomplish this, but if my class creates other types of controls it would have to have a delegate for each type, which is definetly not a good solution.
Does any one knows what is the right way of doing something like this?