problem about reaching to the public member of the parent form

G

Guest

hi, i have a MdiParent form 'Form1' , and the MdiChild of this form 'Form2' .
i have already done the initialization like form2 = new Form2( );
form2->MdiParent = this;
when i try to reach the public member of the parent form 'Form1' from Form2
like temp = Form1::member; it gives error...so how can i reach the public
member of the parent form... ?
 
H

Herfried K. Wagner [MVP]

kkirtac said:
hi, i have a MdiParent form 'Form1' , and the MdiChild of this form
'Form2' .
i have already done the initialization like form2 = new Form2( );
form2->MdiParent = this;
when i try to reach the public member of the parent form 'Form1' from
Form2
like temp = Form1::member; it gives error...so how can i reach the public
member of the parent form... ?

You have to cast 'form2->MdiParent' to the type of the parent form and call
the method on the casted reference.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top