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 access variable from the another dialog box

how to access variable from the another dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelp
4 Posts 4 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.
  • S Offline
    S Offline
    shiva shankar
    wrote on last edited by
    #1

    plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....

    M 2 V 3 Replies Last reply
    0
    • S shiva shankar

      plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      Q: How is a variable of an object of class type accessed? A: Make the variable public. Dialog boxes in MFC programs are represented as classes, for example, CAboutDlg, CTestDlg, etc. Just move that variable(s) to public section of the class definition. Maxwell Chen

      1 Reply Last reply
      0
      • S shiva shankar

        plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....

        2 Offline
        2 Offline
        224917
        wrote on last edited by
        #3

        declare same as extern in the cpp file where u want to access its member, then call like same.array1


        It's not a bug, it's an undocumented feature.
        suhredayan@omniquad.com

        messenger :suhredayan@hotmail.com

        1 Reply Last reply
        0
        • S shiva shankar

          plz can any one help me how access the variable(cstring or int )which is intialized in the other class(dialog box). i am not able to do with the conventional method i,e creating a object and accessing the variable Cdialog1 same; (where "Cdialog" is class and "same" is an object) same.array1; (array1 is an varaible of object "same") the above method is not working please can any one guide me....

          V Offline
          V Offline
          V 0
          wrote on last edited by
          #4

          CDialog is an MFC class, you have to create your own Dialog (eg. LogonDialog) and derive this from CDialog. You can create your array (preferably in the PRIVATE part) in this class, then you write a PUBLIC function which returns your array. thus: int[] LogonDialog::GetArray(){ return array; } this should get you on the move. (yes you can declare your array public, but this is no good incapsultation)

          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