CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    5

    Question How to create a CListBox array?

    HI,
    I use C++ MFC in Visual Studio, in the program header, I create a CListView variable by

    CListBox m_list[6];


    As m_list is only a pointer and not an actual variable,
    Then in the program, I try to initialize each by

    m_list[0] = new CListBox;


    But it fail to compile and show an error message as

    binary '=' : no operator found which takes a right-hand operand of type 'CListBox *' (or there is no acceptable conversion)

    But if I don't initialize each and save data to it by

    m_list[0].AddString("Test");

    it will certain break the program when it run.

    So how could i initialize it?

    Beside, is there any CListBox member to clear all its content immediately? do I need to clear one string by one string in the CListBox

    Thanks in advance!!!

    Martin

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

    Re: How to create a CListBox array?

    As m_list is only a pointer and not an actual variable,
    Then in the program, I try to initialize each by
    no it isn't, but this is:
    Code:
    CListBox *m_list[6];
    Your problem is the fact that you don't create the CListBox:
    Code:
    m_list[0].Create (bla, bla, bla);
    Beside, is there any CListBox member to clear all its content immediately? do I need to clear one string by one string in the CListBox.
    Code:
    m_list[0].ResetContent ();
    Last edited by Skizmo; January 17th, 2007 at 12:51 PM.

  3. #3
    Join Date
    Jan 2007
    Posts
    5

    Thumbs up Re: How to create a CListBox array?

    Thanks for all you guys!
    Have a nice day!

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