CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: DoDataExchange

  1. #1
    Join Date
    Apr 1999
    Posts
    17

    DoDataExchange

    I want to validate the data in the DodataExchange() for two different cases. For example, for case 1, the values of x are in range 1 to 10 whereas for case two the values of x are in range from 10 to 1000. (where x is displayed in the Edit box)

    Any hint???

    Thanks in advance,
    Amy


  2. #2
    Join Date
    May 1999
    Location
    Toronto, Ontario, Canada
    Posts
    155

    Re: DoDataExchange

    I had a simliar problem a while back with validating the number of days in a given month. Here is the code that I used to validate it.

    void CTimeWizardPage:oDataExchange(CDataExchange* pDX)
    {
    CPropertyPage:oDataExchange(pDX);
    //{{AFX_DATA_MAP(CTimeWizardPage)
    //}}AFX_DATA_MAP
    if ((m_iMonth == 2) && !(m_iYear % 4)) {
    DDV_MinMaxInt(pDX, m_iDay, 1, 29);
    } else {
    DDV_MinMaxInt(pDX, m_iDay, 1, iDayRange[m_iMonth]);
    }
    }



    I put it after the class wizard stuff so that when I use class wizard, it won't mess up my 'customized' validation code.

    -Safai

  3. #3
    Join Date
    Apr 1999
    Posts
    17

    Re: DoDataExchange

    Thanks for the hint. I tried exactly as follows:

    DDX_Text(pDX, IDC_SPEED, Speed);
    //}}AFX_DATA_MAP

    if (type == first)
    DDV_MinMaxFloat(pDX, Speed, 1.0, 10.0);
    else
    DDV_MinMaxFloat(pDX, Speed, 10.0, 1000.0);



    When I execute the app., it shows the message to select between 1 to 10 before starting the app.

    Any idea why???
    Thanks.
    Amy


  4. #4
    Join Date
    May 1999
    Location
    Toronto, Ontario, Canada
    Posts
    155

    Re: DoDataExchange

    "Speed" is properly not initialized before you call "CDialog::OnInitDialog()" or "CPropertyPage::OnInitDialog()". DDX and DDV routines are called by the framework's OnInitDialog().

    -Safai

  5. #5
    Join Date
    Apr 1999
    Posts
    17

    Re: DoDataExchange

    I have initalized the Speed in the constructor to be 10.
    Amy


  6. #6
    Join Date
    May 1999
    Location
    Toronto, Ontario, Canada
    Posts
    155

    Re: DoDataExchange

    I have no idea why it puts up that message. Try putting a breakpoint in your DoDataExchange function and step through it to see if Speed or Type is set right.

    -Safai

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