how do i access controls (e.g. EDIT control) on a child dialog from the parent dialog.

Im working on a parent dialog with a tabcontrol. Im using 3 child dialogs for the 3 tabs. Each of the child dialogs has EDIT controls and COMOBOXES. The parent dialog has 2 buttons, OK and CANCEL. CANCEL is for exiting the application and works fine. In button OK, I would like to get all the values entered in the child dialog controls in the 3 tabs. The code snippet include below is for this button and shows the error: Debug Assertion Failed! I have tried in vain to fix this problem.

Can someone please tell me how i can get the text values of the controls on the child dialogs from the parent dialog?
void CMyTabExampleDlg::OnOK() 
	// TODO: Add extra validation here

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Normally, one would use CPropertySheet and CPropertyPage objects with that kind of setup.  These provide the functionality that you describe and also provide handy functions for accessing the property pages data.
What is the message that comes up with the assertion?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VbMonkAuthor Commented:
thanx sage, for the response. I gonna have to try the property sheets. Do you have sample code or website with an example you can refer me to?
The Microsoft site is always a good place to start:
    CPropertySheet Class
Codeguru has lots of examples -- most of them extend the class to do special things with it, but they always include a working example:
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

VbMonkAuthor Commented:
hey, thanx a lot.
btw, im using visual studio 6 C++. I hope I wont get any problems.
VbMonkAuthor Commented:
Ive tried the propertysheet and propertypages but i dont seem to get it to get text from controls (comboboxes, edit boxes, check boxes etc). Please help me with some example of how to get this data. At the moment im using this piece of code which crashes on p->GetdlgItemText......Im doing this inside A cpp file of one of the propertypages. Please help!!
void CPage1::OnRunSchedule() 
	// TODO: Add your command handler code here
	CPage1 p1;
	CPage1 *p;
	CString s;

Open in new window

MFC makes this easy.  Use the ClassWizard (Ctrl+W).  Select a CPropertyPage-derived object and click the Member Variables tab.  Now you can create a variable that relates to a control ID and MCE will transfer the user input into that variable.   Also, by pre-setting the variable before showing the page, MFC will preset default values into the controls for you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.