Member Variable in Property Page

It seems like it is not possible to access member variable from a property page as described below.

I have a sheet holder and two property page which are page1 and page2

From page 1, I went to the class wizard and created a member variable named m_Edit which is type of control.

Now, from the main page, the page that hold property sheet 1 and 2 I went to the OnInitDialog and do something like that

m_Edit.SetWindowText("Some Text);//not working

however, if I do something like that it works fine

CEdit* pEdit;
pEdit = (CEdit*)Page1->GetDlgItem(IDC_EDIT1);
pEdit->SetWindowText("Some Text");

I wonder if there is a possibility where I can make the first case work. It will take me time if I can't, because I do have a dialog with a lot of control on it, I would like to change it to property page in order to make it user friendly. It would have been easier for me if I can drage these control and put them to different seet without any change. For the second case, I have to make a lot of changes.
[1084 byte] By [vcstarter] at [2007-11-18 17:41:30]
# 1 Re: Member Variable in Property Page
What do you mean "not working"? Are you calling SetWindowText before or after the call to the base class OnInitDialog()?
GCDEF at 2007-11-11 1:26:01 >
# 2 Re: Member Variable in Property Page
I am calling it inside the OnInitDialog, after all my property page initialization. The reason is not working, because the control is not in the main page(the page holder), it is on page one.
vcstarter at 2007-11-11 1:27:03 >
# 3 Re: Member Variable in Property Page
Originally posted by vcstarter
I am calling it inside the OnInitDialog, after all my property page initialization. The reason is not working, because the control is not in the main page(the page holder), it is on page one.

Please be specific when you say not working. Nothing happens, doesn't compile, generates an assert, crashes all point to different problems. Remember we are not mind readers here.

If the control is on a page and not the sheet can you set its value in the page's OnInitDialog? I take it that is isn't compiling because m_Edit isn't a member of the sheet. If that's the case just call m_Page1.m_Edit.SetWindowText, or whatever is appropriate in your case.
GCDEF at 2007-11-11 1:28:13 >
# 4 Re: Member Variable in Property Page
Here is what I am talking about, look at on the OnInitDialog on the main page of the project
vcstarter at 2007-11-11 1:29:10 >
# 5 Re: Member Variable in Property Page
m_Edit is a member of class CPage1. You're trying to call it from class CTestPropertyPage1Dlg. Make m_Edit a member of CTestPropertyPage1Dlg and it should work.
GCDEF at 2007-11-11 1:30:09 >
# 6 Re: Member Variable in Property Page
How can i make m_Edit as a member of CTestPropertyPage1Dlg?
vcstarter at 2007-11-11 1:31:08 >
# 7 Re: Member Variable in Property Page
Originally posted by vcstarter
How can i make m_Edit as a member of CTestPropertyPage1Dlg?

Class Wizard
GCDEF at 2007-11-11 1:32:12 >