void Button3_Click(System.Object sender, System.EventArgs e)
{
try
{
string path = (@"Hard Disk\POINTS.txt");
StreamReader sr = new StreamReader(path);
int k = 0;
string[] chartlines = sr.ReadToEnd().Split(new char[]{'\n'});
foreach(string file in chartlines)
{
string Chart = chartlines[k];
string xchart = Chart.Split(';')[0];
string ychart = Chart.Split(';')[1];
int xval = Int32.Parse(xchart);
int yval = Int32.Parse(ychart);
Globals.Tags.X_ARRAY[k].Value = xval;
Globals.Tags.Y_ARRAY[k].Value = yval;
k++;
}
Globals.Tags.CHECK.Value = Globals.Tags.X_ARRAY[15].Value;
//check values on screen
Globals.Tags.CHECK1.Value = Globals.Tags.Y_ARRAY[15].Value;
}
catch
{
MessageBox.Show("Error"):
}
}
每次运行proogram时都会显示错误,并且没有将值设置为数组。任何想法为什么?我在iXDeveloper上编写程序并将其导出到X2 pro 7 HMI。