Solved

How to remove all series in a Chart

Posted on 2011-09-16
4
1,174 Views
Last Modified: 2012-06-27
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
Comment
Question by:PhilippeRenaud
  • 2
  • 2
4 Comments
 
LVL 51

Expert Comment

by:HainKurt
ID: 36550461
maybe you should create a new series and assign it to chart.series...
0
 
LVL 1

Author Comment

by:PhilippeRenaud
ID: 36550535
but I do not wnat to see the previous series... ??
0
 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
ID: 36550750
in a loop maybe you can do this

while (Chart1.Series.Count > 0) Chart1.Series.RemoveAt(0);
0
 
LVL 1

Author Closing Comment

by:PhilippeRenaud
ID: 36550868
yup.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question