Bootsie123 Bootsie123 - 27 days ago 5x
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;


Change like this,

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