Bootsie123 Bootsie123 - 2 months ago 9
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

Change like this,

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