Accessing a Property in An Owner Form

  • Thread starter Thread starter Tony_Hedge
  • Start date Start date
T

Tony_Hedge

Guest
I have a small program with 2 forms: F_Main, the Main form, and F_Edit, a dialogbox.

F_Main displays F_Edit in Modal mode as follows:

new F_Edit().ShowDialog( this );

F_Main has a Public Property: X

In F_Edit I can access F_Main's property X as follows:

F_Main Main = (F_Main)this.Owner;
Main.X= 1;

However I cannot access X as follows:

(F_Main)this.Owner.X = 1;

or (F_Main)(this.Owner).X = 1;


Why is this?

Continue reading...
 
Back
Top