My application has got a form called 'myForm' with a text box called 'Messages' that is used to display status and error messages. I want to write to this control from any part of my code. In my form code I have a method called 'myForm.writeMessage'. The trouble is my application is deeply nested: method a calls method b calls method c .... calls method k.
Do I really need to pass the 'myForm' reference to all objects and all the way down the chain of method calls? This is very inconvenient. I tried redesigning 'writeMessage' as a static method but then it cant refer to the form controls.
I guess I'm stuck with passing the form reference around all over the place seeing as so many parts of my application need to write to the form. It would be great if there was some way of achieving a static way to do this. Hoping someone knows a clever way to do it.
Many thanks in advance for lending me your awesome brain :-)