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

    Data communication between two dialogs

    CListCtrl m_ListCtrl; // a member variale in dialog1

    I am currently in dialog2, and I want to call dialog1, and to fill it with the data in the parent dialog.

    CDialog1 dlg;
    dlg.DoModal();

    How shall I fill m_ListCtrl with data from dialog2?

    Please tell me how to pass pointers. A piece of code will be highly appreciated.
    thankyou in advance.


  2. #2
    Join Date
    Apr 1999
    Posts
    14

    Re: Data communication between two dialogs

    Hi!
    I think you should share data at the layer of parent window. Or share method...

    Best regards, Bob.

  3. #3
    Join Date
    May 1999
    Posts
    388

    Can you elaborate it more!

    I am afriad I didn't get your point enough to be able to implement it. Can you elaborate this a little more.
    I appreciate your help.



  4. #4
    Join Date
    May 1999
    Location
    Houston - TX - US
    Posts
    29

    Re: Data communication between two dialogs

    Hi,
    In Dialog1 Class provide public member function to set the values of the variables that U think need to be done from the Dilaog2 class. Then in Dilaog2, just b4 U call Dlg1.DoModal() set those values .

    ex:

    class Dialog1
    {
    private
    int ValuefromDilaog2 ;

    public:

    void SetvaluefromDilaof2( int val )
    ..
    ..
    } ;

    class Dialog1::SetvaluefromDilaof2( int val )
    {
    ValuefromDilaog2 = val ;
    }



    now in Dialog 2 one function

    void Dialog2::MyFunction()
    {
    Dilaog1 dlg1 ;

    dlg1.SetvaluefromDilaof2( 123 );
    dlg1.DoModal() ;
    }

    Hope this helps You.
    Good Luck.
    Yash.





  5. #5
    Join Date
    May 1999
    Posts
    388

    thankx

    thankx for the help. I will try to implent it.


  6. #6
    Join Date
    Apr 1999
    Posts
    14

    Re: thankx

    And if you called Dialog2 within Dialog1 then

    void Dialog2::MyFunction()
    {
    ((Dialog1*)GetParent())->SetvaluefromDilaof2( 123 );
    }

    But in this case both classes must know about each other.

    Best regards, Bob.

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