"Object required" (When add variable)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: "Object required" (When add variable)

  1. #1
    Join Date
    Dec 2007
    Posts
    9

    "Object required" (When add variable)

    Hi,

    In VC++ 2005, when I add a variable to a dialog (m_slider for a slider control in that dialog), the class wizard always returned me "Object required", without any other informations.

    Could anyone please help me for this problem? It's driving me nut!

    Thanks in advanced.

  2. #2
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Re: "Object required" (When add variable)

    Quote Originally Posted by hoainam85
    Hi,

    In VC++ 2005, when I add a variable to a dialog (m_slider for a slider control in that dialog), the class wizard always returned me "Object required", without any other informations.

    Could anyone please help me for this problem? It's driving me nut!

    Thanks in advanced.
    So you may prefer to assing a variable by writing a line, like that:
    Code:
     
    CSliderCtrl* pSlider = (CSliderCtrl*) GetDlgItem(IDC_SLIDER1);

  3. #3
    Join Date
    Dec 2007
    Posts
    9

    Re: "Object required" (When add variable)

    Thanks Hakan!

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,201

    Re: "Object required" (When add variable)

    Quote Originally Posted by hoainam85
    Hi,

    In VC++ 2005, when I add a variable to a dialog (m_slider for a slider control in that dialog), the class wizard always returned me "Object required", without any other informations.

    Could anyone please help me for this problem? It's driving me nut!

    Thanks in advanced.
    When you add the variable, do you have the control highlighted when you click on the 'Add variable...' menu item?

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: "Object required" (When add variable)

    You can also add a CSliderCtrl member variable manually to the class, and then in DoDataExchange add this:
    Code:
    void CYourDlg::DoDataExchange(CDataExchange* pDX)
    {
       CDialog::DoDataExchange(pDX);
    
       DDX_Control(pDX, IDC_SLIDER_ID, &m_slider);
    }
    That's exactly what VS is doing for you.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center