Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2203
  • 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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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