Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to transfer data betwn two dialogs

how to transfer data betwn two dialogs

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajesh match
    wrote on last edited by
    #1

    i am one project where i have to transfer controls data between two dialog. i can manage to send the data from ist dialog to second like this... CMyDialog2 m_mydlg2; m_mydlg2.myvariable2=myvariable1; m_mydialog2.DoModal(); this works correctly but now i need to get the data of second dialog in first one after closing the second dialog can anyone help me for that thax

    M D 2 Replies Last reply
    0
    • R Rajesh match

      i am one project where i have to transfer controls data between two dialog. i can manage to send the data from ist dialog to second like this... CMyDialog2 m_mydlg2; m_mydlg2.myvariable2=myvariable1; m_mydialog2.DoModal(); this works correctly but now i need to get the data of second dialog in first one after closing the second dialog can anyone help me for that thax

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      CMyDialog2 m_mydlg2; m_mydlg2.myvariable2=myvariable1; int nRet = m_mydialog2.DoModal(); if(nRet == IDOK) // if okay was clicked get the data from the dialog { myvariable1 = m_mydialog2.myvariable2; // get the variable back out of the dialog } Michael

      1 Reply Last reply
      0
      • R Rajesh match

        i am one project where i have to transfer controls data between two dialog. i can manage to send the data from ist dialog to second like this... CMyDialog2 m_mydlg2; m_mydlg2.myvariable2=myvariable1; m_mydialog2.DoModal(); this works correctly but now i need to get the data of second dialog in first one after closing the second dialog can anyone help me for that thax

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Use Michaels's suggestion, or pass a pointer to the second dialog, as in:

        m_mydlg2.myptrvariable2 = &myvariable1;

        Now when myptrvariable2 is modified in the second dialog, the first dialog will automatically "see" the change(s).


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups