Bootsie123 Bootsie123 - 1 year ago 125
C# Question

Enum.Parse Error

I'm trying to change a the chart type for a series by using a variable. Here's what I have.

Graph.Series[SeriesName.Text].ChartType = Enum.Parse(SeriesChartType, GraphType.Name);

Although I get an error which is

'SeriesChartType' is a type, which is not valid in the given context

How can I fix this? I am using

using System.Windows.Forms.DataVisualization.Charting;

Answer Source

Change like this,

Graph.Series[SeriesName.Text].ChartType = Enum.Parse(typeof(SeriesChartType), GraphType.Name);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download