• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2326
  • Last Modified:

How to remove all series in a Chart

Hello EE,

I am creating series inside a chart in VB.Net with a DataSource.
when user click on another button I want the chart to refresh with another Datasource. But I need to delete all series first because otherwise I am having error saying series already exists. name must be unique.

I am not sure how to remove programmatically all the series with a for Next

any ideas?
0
PhilippeRenaud
Asked:
PhilippeRenaud
  • 2
  • 2
1 Solution
 
HainKurtSr. System AnalystCommented:
maybe you should create a new series and assign it to chart.series...
0
 
PhilippeRenaudAuthor Commented:
but I do not wnat to see the previous series... ??
0
 
HainKurtSr. System AnalystCommented:
in a loop maybe you can do this

while (Chart1.Series.Count > 0) Chart1.Series.RemoveAt(0);
0
 
PhilippeRenaudAuthor Commented:
yup.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now