A
A
armadillo-cld2020-07-13 22:40:53
MFC
armadillo-cld, 2020-07-13 22:40:53

How to access the parent dialog window element from the child dialog window?

Hello.
I have a main dialog. Let's name it CAppDlgwith ID - IDD_MAINFORM.
There is also another dialogue. Let's name it CAnotherDlgwith ID - IDD_ANOTHERFORM.
And there is ListBoxwith a variable app_ListBox.
In the main dialog, on clicking the button, I show the second dialog:

void CAppDlg::OnBnClickedButton1()
{
  CAnotherDlg().DoModal();
}

Next, in the second dialog, on clicking the button, I try to add an element to the ListBoxfirst dialog.
void CAnotherDlg::OnBnClickedButton1()
{
  CAppDlg dlg;
  dlg.app_ListBox.AddItem(L"123");
  // Так же пробовал добавить - dlg.DoModal();
}

But after all that has been done, ListBoxthere is nothing.
Why can't I add the element?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question