Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Go Back  Xtreme Visual Basic Talk > > > > Object not set to reference error on running 'End' command


Reply
 
Thread Tools Display Modes
  #1  
Old 07-01-2005, 03:57 PM
under_seeg under_seeg is offline
Regular
 
Join Date: Feb 2004
Posts: 64
Default Object not set to reference error on running 'End' command


i am having an error with directx where its saying:

Quote:
An unhandled exception of type 'System.NullReferenceException' occurred in microsoft.directx.direct3dx.dll

Additional information: Object reference not set to an instance of an object.
i can only assume its talking about my 'device as Direct3D.Device' object. but it only goes away when i do the Dispose line, which takes absolutely ages if my programs been running a long time, and frankly i'd prefer to have an error at the end and it instantly quit and have to wait ages and risk crashing the computer every time i stopped my game. in the Form1_Closed event it has the following liens...

Code:
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed 'device.Dispose() device = Nothing bIsRunning = False End End Sub
Reply With Quote
  #2  
Old 07-02-2005, 09:19 AM
Iceplug's Avatar
IceplugObject not set to reference error on running 'End' command Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Why do you need to call End when your form is closed?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 07-04-2005, 02:24 PM
under_seeg under_seeg is offline
Regular
 
Join Date: Feb 2004
Posts: 64
Default

oops...! i probably copied from the code when i press escape since i wanted it to do the same thing, but it doesnt matter because thats not the line thats taking ages, i debugged it and on the Dispose line is when it struggles, so i guess some inside information on what Dispose does would help get this problem solved, but it sounds like a big procedure, i guess next time i'll find all the lines that use procedures from the device because if i know every way i'm interacting with it, i'll have the problematic part in front of me. next time i'm there i'll sort it out and post again, until then i'd be thankful for any input.
Reply With Quote
  #4  
Old 07-04-2005, 07:36 PM
Iceplug's Avatar
IceplugObject not set to reference error on running 'End' command Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Sounds like you have set device = Nothing before you run this code... and the most probable cause is you setting the device = Nothing (in the Escape key or something), and then doing Me.Close(), which runs the above code.

To remedy this, I'd just call Me.Close() instead of trying to shut down the device from the Escapekey closing sequence.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #5  
Old 07-07-2005, 10:11 AM
under_seeg under_seeg is offline
Regular
 
Join Date: Feb 2004
Posts: 64
Default

Quote:
Originally Posted by Iceplug
Sounds like you have set device = Nothing before you run this code... and the most probable cause is you setting the device = Nothing (in the Escape key or something), and then doing Me.Close(), which runs the above code.

To remedy this, I'd just call Me.Close() instead of trying to shut down the device from the Escapekey closing sequence.
this isnt the main problem though i try it with both escape and just closing it, but i think i'm looking at it the wrong way, i just need to figure out whats wrong with the disposing.
Reply With Quote
  #6  
Old 07-07-2005, 10:18 AM
Iceplug's Avatar
IceplugObject not set to reference error on running 'End' command Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

You can always try:

If Not (device Is Nothing) Then
device.Dispose()
End If
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #7  
Old 07-07-2005, 10:20 AM
under_seeg under_seeg is offline
Regular
 
Join Date: Feb 2004
Posts: 64
Default

Good idea, I should use more error handling like that you know.
Reply With Quote
  #8  
Old 07-07-2005, 01:24 PM
Machaira's Avatar
MachairaObject not set to reference error on running 'End' command Machaira is offline
Jedi Coder

* Expert *
 
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
Default

You might also want to put the line:

bIsRunning = False

before destroying the device so that your game code isn't run after the device is destroyed.
Reply With Quote
  #9  
Old 07-17-2005, 02:26 AM
under_seeg under_seeg is offline
Regular
 
Join Date: Feb 2004
Posts: 64
Default

hey thanks to what i talked about in the other thread about disposing things properly its worked, not only does it close fast, it doesnt have any errors either!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
 
Object not set to reference error on running 'End' command
Object not set to reference error on running 'End' command
 
-->