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. access to variable from another CDialog

access to variable from another CDialog

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 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.
  • Z Offline
    Z Offline
    zizzzz
    wrote on last edited by
    #1

    Hi, my problem is that I have a CDialog1(myClass1) in which I insert a propetysheet (using Picture Ctrl) in this propertysheet i add a propertyPage which generate me a CDialog2(myClass2). I want to get variable from this CDialog and pass it to the first one because I'm sending thoses data into an access table. I tried to get those parameters with this function void CGeneralUser::GetParameter(CString& sStatus,CString& sgender,CString& stel,CString& smobile) { sStatus=m_status; sgender=m_gender; stel=m_tel; smobile=m_mobile; } then I call this function in the first class(myClass1) like this in boutton OK CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1); When I write AfxMessageBox(sStatus1) for exemple the messagebox is empty I put UpdateData(TRUE); but it doesn't work why???? thank's for your help :confused: c zizzzzzzzzzzz

    C 1 Reply Last reply
    0
    • Z zizzzz

      Hi, my problem is that I have a CDialog1(myClass1) in which I insert a propetysheet (using Picture Ctrl) in this propertysheet i add a propertyPage which generate me a CDialog2(myClass2). I want to get variable from this CDialog and pass it to the first one because I'm sending thoses data into an access table. I tried to get those parameters with this function void CGeneralUser::GetParameter(CString& sStatus,CString& sgender,CString& stel,CString& smobile) { sStatus=m_status; sgender=m_gender; stel=m_tel; smobile=m_mobile; } then I call this function in the first class(myClass1) like this in boutton OK CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1); When I write AfxMessageBox(sStatus1) for exemple the messagebox is empty I put UpdateData(TRUE); but it doesn't work why???? thank's for your help :confused: c zizzzzzzzzzzz

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Please, use the code or pre tags when you post code !

      zizzzz wrote:

      CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1);

      What you will do here is create a new instance of your CMyClass2 class and retrieve the parameters directly. So, for sure they are still to the default value because it is another class. You have to retrieve the data of your existing class, and not create a new class. This has nothing to do with dialogs or property pages but with how you manages your classes.


      Cédric Moonen Software developer
      Charting control [Updated - v1.1]

      Z 1 Reply Last reply
      0
      • C Cedric Moonen

        Please, use the code or pre tags when you post code !

        zizzzz wrote:

        CMyClass2 user; user.GetParameter(sStatus1,sgender1,sTel1,smobile1);

        What you will do here is create a new instance of your CMyClass2 class and retrieve the parameters directly. So, for sure they are still to the default value because it is another class. You have to retrieve the data of your existing class, and not create a new class. This has nothing to do with dialogs or property pages but with how you manages your classes.


        Cédric Moonen Software developer
        Charting control [Updated - v1.1]

        Z Offline
        Z Offline
        zizzzz
        wrote on last edited by
        #3

        ok I tried to retreive data from my existing class so I put in MyClass1.h : CMyClass2 m_classe2; and I call my parameter like this m_classe.status i should proceed like that ? :~ because i had errors when running the programm :sigh: thank's :) c zizzzzzzzzzz

        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