@FrancescoMarciano Ivan, your code is the same as this:
Window1.Label1.Text = "xxxxxx"
A simple summary:
- i have two windows (Window1 and Window2) with a textfield and a label each one;
- i created a subclass of the textfield class with an event handler for the textchange event;
- the super of my textfields in the windows is my subclass;
- i want to share this subclass with my two windows;
- i need a reference of the source window in the textchange event to write a code like this: mywin.label1.text = "modified" where mywin could be Window1 or Window2;
It seems a simple question (for me) but maybe i really have "problems with the OOP".
Yes I think you do. My code it is not the same. maybe it is not clear what I meant with "super", Window1 and Window2 are two objects with diferent types. Those 2 are subclases, their super is Window. A reference of type Window, can't access the propertys of the subclases.
If you have only 2 windows with implicit instance, just use a static reference using a if to send the message to Window1 or Window2.
If you have more windows, or more than one instance of each, better use something like the Observer Design Pattern