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

    Post regarding command button usage

    i wished to exchange the data of my dialog box to variables only if the user clicks on the OK command button and not if he clicks on CANCEL button
    My code is
    Code:
    busd.DoModal ();
    if(busd.m_ok )
    {
    int index=pDoc->GetBusIndex (m_BusNo);
    BusSize=atol(busd.m_size);
    m_BusNo=busd.m_busno;
    m_BusType=busd.m_bustype;
    m_Volts=busd.m_voltage;
    m_LoadAngle=busd.m_loadangle;
    m_BusName=busd.m_busname;
    z=b->m_size;
    ltoa((b->m_BusNo),temp,10);
    m_BusNo=temp;
    pDoc->AppendBus(busindex,b->m_x1 ,b->m_y1 ,b->m_x2 ,b->m_y2 ,z,atol(m_BusNo),b->m_bOrien ,m_BusType,m_Volts,m_LoadAngle,m_BusName);
    }
    above m_ok is variable that i have attached to command button and is of category "control" .....it never goes into this loop......kindly please tel what modifications i need to do??

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: regarding command button usage

    Code:
    if(busd.m_ok )
    What do you expect this does ? What it really does, it checks if the pointer to m_ok is still there.. .but it isn't because after DoModal () all resources are destroyed.


    DoModal () has a return value... you can use it to determine what button was pressed.
    Last edited by Skizmo; June 4th, 2009 at 02:57 PM.

Tags for this Thread

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