The code has been running without problem for more than 5 year. But then I had to change from Win7 VS2013 to Win10 VS2017, BAM! I got this error.
System.InvalidOperationException
HResult=0x80131509
Message=Collection was modified; enumeration operation may not execute.
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Microsoft.VisualBasic.PowerPacks.ShapeCollection.Dispose(Boolean disposing)
at Microsoft.VisualBasic.PowerPacks.ShapeContainer.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at System.Windows.Forms.ContainerControl.Dispose(Boolean disposing)
at MN_Bargraph.MN_BarGraph.Dispose(Boolean disposing) in C:\MN_Bargraph\UserControl1.Designer.vb:line 13
It said something about .Designer.vb line 13
So I comment out the line as shown below
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
'MyBase.Dispose(disposing)
End Try
End Sub
Now no errors, why this works or what the designer.vb code does, don't ask me.
I'm happy and clueless, good enough for me for now 😂
No comments:
Post a Comment