Dundas Chart - how to check if a Chart Series exists before manipulating it?
Posted on 2006-11-09
I'm creating a reusable sub to add formatting to 2 chart series within a Dundas Chart. Occasionally however, the second series doesn't actually exist (based on the data returned from a datatable), so I am getting an Invalid Argument exception when I try the following code. Can any help show me how to avoid this error?
<DCWC:Chart ID="Chart1" runat="server">
<DCWC:Series Name="Default" />
<DCWC:Series Name="Totals" />
<DCWC:ChartArea Name="Default" />
If Chart1.Series("Totals") IsNot Nothing Then ' <-- error here: Data series with name "Totals" was not found in the series collection
' perform chart colouring functions