为什么我一直在“收集被修改;枚举操作可能不会执行“在VB.Net中绘制图表 [英] Why do I keep having "Collection was modified; enumeration operation may not execute" in charting in VB.Net

查看:88
本文介绍了为什么我一直在“收集被修改;枚举操作可能不会执行“在VB.Net中绘制图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的图表中添加了随机点。

(Imports System.Windows.Forms.DataVisualization.Charting)

保存在文本文件中。

随着数据累积,我遇到这个错误:





异常:抓到:收集被修改;枚举操作可能无法执行。 (System.InvalidOperationException)

捕获到System.InvalidOperationException:| Collection已被修改;枚举操作可能无法执行|

时间:10/21/2015 10:36:07 AM

线程:无名称[1456]





我在每个代码中添加了Try Catch但它没有显示任何错误,图表中有红叉。会发生什么?

I was adding random points in my chart.
(Imports System.Windows.Forms.DataVisualization.Charting)
while saving in textfile.
And as data accumulated, I encounter this error:


Exception:Caught: Collection was modified; enumeration operation may not execute. (System.InvalidOperationException)
A System.InvalidOperationException was caught: |Collection was modified; enumeration operation may not execute|
Time: 10/21/2015 10:36:07 AM
Thread:No Name[1456]


I added Try Catch in every code but It does not show any error and graph has red cross in it. What happen?

推荐答案

>会发生什么?



您试图在枚举(迭代)过程中修改集合。这是不允许的。



/ ravi
> What happen?

You attempted to modify a collection while enumerating (iterating) through it. That's not permitted.

/ravi


这篇关于为什么我一直在“收集被修改;枚举操作可能不会执行“在VB.Net中绘制图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆