Hi, i had two questions... I asked two questions inside the photo.

Majeed Purseyedmahdi 41 Reputation points
2021-09-25T17:28:10.11+00:00

135140-chart.jpg

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,835 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,396 questions
{count} votes

Accepted answer
  1. Jack J Jun 24,296 Reputation points Microsoft Vendor
    2021-09-27T08:42:26.707+00:00

    @Majeed Purseyedmahdi , about your second question, you could refer to the following code to use combobox to load different types in chart.

    private void Form1_Load(object sender, EventArgs e)  
            {  
                fillChart();  
                var resourceStream = typeof(System.Windows.Forms.DataVisualization.Charting.Chart)  
                .Assembly.GetManifestResourceStream("System.Windows.Forms.DataVisualization.Charting.Design.resources");  
                using (System.Resources.ResourceReader resReader = new ResourceReader(resourceStream))  
                {  
                    var dictEnumerator = resReader.GetEnumerator();  
                    while (dictEnumerator.MoveNext())  
                    {  
                        var ent = dictEnumerator.Entry;  
                         
                        comboBox1.Items.Add(ent.Key);  
                    }  
                }  
            }  
      
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)  
            {  
                Console.WriteLine(comboBox1.SelectedItem.ToString().Replace("ChartType",""));  
                string a = comboBox1.SelectedItem.ToString().Replace("ChartType", "");  
                SeriesChartType type = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), a);  
                chart1.Series[0].ChartType = type;  
            }  
    

    Result:

    135496-8888.gif


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful