CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    327

    how can I update an edit box

    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.


  2. #2
    Guest

    Re: how can I update an edit box

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured