调试时提示已定义具有相同参数类型的成员,求指导
最近想用C#做一个上位机程序,想用MSCHART来做数据实时显示,直接拷贝微软实例里的源代码,调试后报错
类型“chartdynamically.form1”已定义了一个名为“dispose”的具有相同参数类型的成员
类型“chartdynamically.form1”已经包含“chart1”的定义
问题是不知道为什么会在form1.designer.cs 里将dispose和chart1重新定义?怎么改代码才能调试通过呢?谢谢!
form1代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using System.Threading;
namespace chartdynamically
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private Thread addDataRunner;
private Random rand = new Random();
private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
public delegate void AddDataDelegate();
public AddDataDelegate addDataDel;
private void RealTimeSample_Load(object sender, System.EventArgs e)
{
// create the Adding Data Thread but do not start until start button clicked
ThreadStart addDataThreadStart = new ThreadStart(AddDataThreadLoop);
addDataRunner = new Thread(addDataThreadStart);
// create a delegate for adding data
addDataDel += new AddDataDelegate(AddData);
}
private void startTrending_Click(object sender, System.EventArgs e)