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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

730 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