Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
This is my Code

C++
class CContactList: public CListCtrl{..}


void CContactList::GetDispInfo(...){
   ...
   ...
   ...
   if(nItem > m_listContacts->GetCount()-1)  //  AAAAAAAA
      ...
}

Plz view AAAAAA
C++
CPtrArray *m_listContacts;  in *.h file

and I already formatted variable
C++
m_listContacts = &m_Array; // in other class


but m_listcontacts variable is NULL in GetDispInfo function.

plz help me.
Posted
Updated 16-Sep-14 23:42pm
v2
Comments
George Jonsson 17-Sep-14 4:29am    
What is the error you get?
Member 11074066 17-Sep-14 4:59am    
error is memory error
"cannot access 0x00000005 in memory
Member 11074066 17-Sep-14 5:02am    
Thank you for your time
I already used debugger
i checked in onInitDialog function
but it is NULL in GetDispInfo function
George Jonsson 17-Sep-14 5:46am    
See Solution 1.
If m_listContacts is NULL it means that m_listContacts = &m_Array; is either not executed or you are using the same variable name in more than one class.
The debugger is your saver here.
Member 11074066 17-Sep-14 7:23am    
Thanks
error is fixed

1 solution

If your value is null, then it probably hasn't been set at all (or the value you are setting it to is null as well).

You probably need to check the code you use to set the m_listContacts: check that you are setting the right instance value, and not a new instance.

Look at that code first, and if it isn't obvious then use the debugger to check exactly what value yoiu are setting it to.

But we can't do that for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900