Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values from one to an other dialog

Status
Not open for further replies.

freak123

Programmer
Aug 1, 2003
3
AT
I have get 2 Dialogs (d1 and d2). I want to use the Values of some variables in an other Dialog.

I write:


d1 dlg;
m_filename = dlg.m_name; //m_filename (from d2) gets´the
//value of dlg.m_name


My problem is that dlg.m_name == "", but in d1 it has a value.

I hope you understand my problem.

 
my guess is that you are not calling UpdateData when you click ok on the dialog.

Matt
 
My Code

If you click on a button in d1 this function will be called

void CEd2kDlg::OnXXX()
{
// TODO: Add your control notification handler code
// here
UpdateData(TRUE);
d2 dlg;
dlg.DoModal();
UpdateData(FALSE);
}


Dialog d2:
int HTML::DoModal()
{

// TODO: Add your specialized code here and/or call
the base class
// TODO: Add your control notification handler code
here
return CDialog::DoModal();
}


BOOL HTML::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
UpdateData(TRUE);
d1 dlg;
m_var1 = dlg.m_var2;
UpdateData(FALSE);

return TRUE; // return TRUE unless you set the
focus to a control
// EXCEPTION: OCX Property Pages
should return FALSE
}

I included the .h files!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top