How to change a member variable in another dialog?

Posted on 2000-05-16
Last Modified: 2010-04-02
In one dialog, I hope to change a member variable(it's type is CStringArray) in another dialog.(The two dialogs exist at the same time)
How to implement this?
Question by:Zhu051200

Expert Comment

ID: 2813471
what do you want to change - value or type

Accepted Solution

abancroft earned 50 total points
ID: 2814647
Are these non-modal in the same application? If so, you could do this:

class CDialog1 : public CDialog
  // Missing stuff...

  CStringArray m_Str;

class CDialog2 : public CDialog
  // Missing stuff...

  CDialog1 *m_pDlg1;

CDialog1 dlg1;
CDialog2 dlg2;

dlg2.m_pDlg1 = &dlg1;


Now dlg2 has access to dlg1.m_Str through it's m_pDlg1 member. Obviously, it'd be a good idea to encapsulate the public members.

Author Comment

ID: 2819759
thanks for your help!

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question