I have a picturebox that I have assigned a bitmap to its image property.
I have this code that throws exceptions periodically. Typically when it is called there are 2500 points in the queue.
Periodically means I have to push the button that adds points(2500) to the queue as fast as possible for a period of time.
I know that the points being set are within the bounds of the bitmap.Code:Dim pt As Point Try Do While newPTS.Count > 0 If newPTS.TryDequeue(pt) Then PBbm.SetPixel(pt.X, pt.Y, PBbmDotColor) End If Loop Catch ex As Exception Dim s As String = String.Format("X: {0} Y:{1} {2}", pt.X, pt.Y, ex.Message) AddToError(s) End Try
PBbm is the bitmap
newPTS is a queue of points
The errors
X: 446 Y:170 Object is currently in use elsewhere.
X: 34 Y:549 Object is currently in use elsewhere.




Reply With Quote