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
Re: How to create a CListBox array?
Quote:
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);
Quote:
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 ();
Re: How to create a CListBox array?
Thanks for all you guys!
Have a nice day!