Page 1 of 1

Disposing of TChart on Net 6

Posted: Wed Aug 03, 2022 3:23 am
by 15687866
Hi,

I apologize for posting a reply to your announcement message because I did not see the "New Topic" button. Your reply on the thread https://www.steema.com/support/viewtopi ... 703#p78724 worked on the base TChart controls, but failed on our controls that inherit from TChart.

Upon further checking, we had the line below that seems to raise the NullReferenceException on Dispose.
tChart1.Graphics3D.BufferStyle = Steema.TeeChart.Drawing.BufferStyle.DoubleBuffer;

This line was inserted to resolve an issue we encountered 9 years ago - http://www.teechart.net/support/viewtop ... 156#p62249.

Do we still need the line to set the BufferStyle?

Re: Disposing of TChart on Net 6

Posted: Wed Aug 03, 2022 11:23 am
by Marc
Hello,

No; if that works ok for you that's fine, ignore my recommendation. I've made a note of the issue I encountered as it may affect other projects with a different buffer setting.

Regards,
Marc

Re: Disposing of TChart on Net 6

Posted: Thu Aug 04, 2022 4:15 am
by 15687866
Thank you for the prompt reply.

Your recommendation (to generate the bitmap) is still required when we generate and dispose of TCharts that are not shown to the user. As it turns out though, we needed to generate the bitmap before setting the bufferStyle to avoid the NullReferenceException. Thank you for the assistance.

Dim x As New Steema.TeeChart.TChart
x.Bitmap(20, 20)
x.Graphics3D.BufferStyle = Steema.TeeChart.Drawing.BufferStyle.DoubleBuffer
x.Dispose()