A statement which as far as i know doesn't close you program properly and hides errors. Right now i'm being forced to use end because i don't know how else to close my program properly. I'm not sure where my problem is but some of you should be able to fix it. I'm trying to make a game using directx with a game loop. This code is the skeleton of what i'm making.
Code:
Public Class Form1
Private ProgRunning As Boolean = True
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Show() 'Make the form appear
Me.Focus() 'Give the form focus
GameLoop() 'Start the game loop
End Sub
Private Sub GameLoop()
Do
REM Draw whatever i want to draw here
Application.DoEvents() 'Allow other things to happen before drawing again
Loop Until ProgRunning = False
End Sub
Private Sub frmDNMain_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
ProgRunning = False
End 'The end of it all
End Sub
End Class
This code runs alright because end is being used but if you rem end out the error which it's hiding comes out. The error is "Object reference not set to an instance of an object." I'm not totally sure but i'm guessing that the error is refering to the form.