Click to See Complete Forum and Search --> : how can I update an edit box


Danielle Harvey
May 21st, 1999, 10:41 AM
I have a dialog box with an edit box. When the user clicks a calculate button, a new dialog box pops-up and the user can input simple data. In the second dialog box's OnOk(), I calculate a value that I want to put into the first dialog's edit box. But I just can't get anything to work. Is there some command called upon returning to the first dialog box?

Any response any one can give me will be greatly appreciated.

May 21st, 1999, 11:06 AM
If you have a variable (e.g., m_result) in second dialog and it will store the calculated value, you can retrieve m_result in dialog 1.
For example:
// when user clicks "Calculate" button in Dialog1
void CDialog1::OnCalculateClicked()
{
UpdateData(); // update all variables
Dialog2 dlg(this);

if(dlg.DoModal()==IDCANCEL) return;

// m_myedit is a numeric variable for editbox
m_myedit = dlg.m_result;

// update dialog
UpdateData(FALSE);
}

Hope this will help. Good luck.

Allen