access to variable from another CDialog
-
Hi, my problem is that I have a CDialog1(myClass1) in which I insert a propetysheet (using Picture Ctrl) in this propertysheet i add a propertyPage which generate me a CDialog2(myClass2). I want to get variable from this CDialog and pass it to the first one because I'm sending thoses data into an access table. I tried to get those parameters with this function void CGeneralUser::GetParameter(CString& sStatus,CString& sgender,CString& stel,CString& smobile) { sStatus=m_status; sgender=m_gender; stel=m_tel; smobile=m_mobile; } then I call this function in the first class(myClass1) like this in boutton OK CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1); When I write AfxMessageBox(sStatus1) for exemple the messagebox is empty I put UpdateData(TRUE); but it doesn't work why???? thank's for your help :confused: c zizzzzzzzzzzz
-
Hi, my problem is that I have a CDialog1(myClass1) in which I insert a propetysheet (using Picture Ctrl) in this propertysheet i add a propertyPage which generate me a CDialog2(myClass2). I want to get variable from this CDialog and pass it to the first one because I'm sending thoses data into an access table. I tried to get those parameters with this function void CGeneralUser::GetParameter(CString& sStatus,CString& sgender,CString& stel,CString& smobile) { sStatus=m_status; sgender=m_gender; stel=m_tel; smobile=m_mobile; } then I call this function in the first class(myClass1) like this in boutton OK CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1); When I write AfxMessageBox(sStatus1) for exemple the messagebox is empty I put UpdateData(TRUE); but it doesn't work why???? thank's for your help :confused: c zizzzzzzzzzzz
Please, use the code or pre tags when you post code !
zizzzz wrote:
CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1);
What you will do here is create a new instance of your CMyClass2 class and retrieve the parameters directly. So, for sure they are still to the default value because it is another class. You have to retrieve the data of your existing class, and not create a new class. This has nothing to do with dialogs or property pages but with how you manages your classes.
Cédric Moonen Software developer
Charting control [Updated - v1.1] -
Please, use the code or pre tags when you post code !
zizzzz wrote:
CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1);
What you will do here is create a new instance of your CMyClass2 class and retrieve the parameters directly. So, for sure they are still to the default value because it is another class. You have to retrieve the data of your existing class, and not create a new class. This has nothing to do with dialogs or property pages but with how you manages your classes.
Cédric Moonen Software developer
Charting control [Updated - v1.1]ok I tried to retreive data from my existing class so I put in MyClass1.h : CMyClass2 m_classe2; and I call my parameter like this m_classe.status i should proceed like that ? :~ because i had errors when running the programm :sigh: thank's :) c zizzzzzzzzzz