Page 1 of 1

Delete all Tools through Code

Posted: Sat Sep 23, 2006 2:35 am
by 9080944
Hello,

I would like to programatically remove all the tools which have been added to a chart. My current code is;

i = 1
While i <= (.Tools.Count - 1)
.Tools.Delete(i)
i = i +1
Wend

This code appears to work most of the time and then other times it will error, I cannot find the source of the fault. Any advice?

My project creates and formats the chart area and series at runtime through code.

When the user requests a new chart, the chart space is formatted again.

What would be handy is a command which will reset the TChart back to it's original state as it sits on the form in the IDE, does such a command work?

Kind Regards
Anthony

Posted: Mon Sep 25, 2006 8:05 am
by narcis
Hi Anthony,

Such a method doesn't exist. However it is on our wish-list to be considered for inclusion in future releases. To clear all tools in a chart the easiest way is using Clear method:

Code: Select all

Private Sub Command1_Click()
    TChart1.Tools.Clear
End Sub