how to access variable from the another dialog box
-
plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....
-
plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....
Q: How is a variable of an object of class type accessed? A: Make the variable public. Dialog boxes in MFC programs are represented as classes, for example, CAboutDlg, CTestDlg, etc. Just move that variable(s) to public section of the class definition. Maxwell Chen
-
plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....
declare same as extern in the cpp file where u want to access its member, then call like same.array1
It's not a bug, it's an undocumented feature.
suhredayan@omniquad.commessenger :suhredayan@hotmail.com
-
plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....
CDialog is an MFC class, you have to create your own Dialog (eg. LogonDialog) and derive this from CDialog. You can create your array (preferably in the PRIVATE part) in this class, then you write a PUBLIC function which returns your array. thus: int[] LogonDialog::GetArray(){ return array; } this should get you on the move. (yes you can declare your array public, but this is no good incapsultation)