Hello Forum I'm learning more about Form Apps in VB.net and I encountered the error 'System.ObjectDisposedException', no matter what I do this error doesn't seem to want to stop.
This error occurs in two stages all under the declaration of BBGO which is declared as graphics.
This should be the relevent code:
Private Sub DrawGraphics()
'FILL THE BACKBUFFER
'DRAW TILES
For X = 0 To 38
For Y = 0 To 28
GetSourceRect(X, Y, TileSize, TileSize)
DRect = New Rectangle(X * TileSize, Y * TileSize, TileSize, TileSize)
GO.DrawImage(Wall, DRect, SRect, GraphicsUnit.Pixel)
Next
Next
GO.DrawRectangle(Pens.Red, mouseX * TileSize, mouseY * TileSize, TileSize, TileSize)
'DRAW TOON
GetSprite(LastDir)
BMPToon.MakeTransparent(Color.Black)
GO.DrawImage(BMPToon, XPos * TileSize * MoveSpeed, YPos * TileSize * MoveSpeed, SRect, GraphicsUnit.Pixel)
'DRAW FINAL LAYERS
'GUYS, MENUS, ETC
GO.DrawString("Controls: " & vbCrLf & _
"W = Up" & vbCrLf & _
"S = Down" & vbCrLf & _
"A = Left" & vbCrLf & _
"D = Right" & vbCrLf & _
"Space = Stop" & vbCrLf & _
"", Me.Font, Brushes.Red, 625, 0)
'COPY BACKBUFFER TO GRAPHICS OBJECT
GO = Graphics.FromImage(BB)
'DRAW BACK BUFFER TO SCREEN
***BBGO = Me.CreateGraphics
BBGO.DrawImage(BB, 0, 0, ResWidth, ResHeight)***
'FIX OVERDRAW
GO.Clear(Color.Black)
End Sub
There is alot more code to this form but I dont want to go over board with it all if you guys need more of the code or any help I'll give it to you but in the mean time I'm going to keep pounding at this error.