I am dynamically creating/allocating an array of CNiGraph objects since I do not know how many I will need at compile time. My project is a doc/view arch., SDI, in VC++ 6.0.
I declare a CNiGraph pointer in the view header, and in the view constructor I create the correct number of graphs like so:
pPlots = new CNiGraph[NumberOfPlotsNeeded];
and then I use the plots without problem.
The problem arises when I try to cleanup the memory I allocated for the plots ( using 'delete [] pPlots;' ).
This line creates a bad pointer error ('Expression: _CrtIsHeapValidPointer(pUserData)');
Could someone also direct me to some sample code using the CNiGraph control which has been dynamically created.
Thanks.