Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object reference not set to an instance of an object. on Form.Close()

Status
Not open for further replies.

andrea96

Programmer
Jan 26, 2001
201
US
I am getting the error "Object reference not set to an instance of an object." when I try to close an MDI child form with
Code:
Me.Close()
It seems anything I try to do to the form at this point in the code gets the same error (ex. Me.Hide() and Me.WindowState = FormWindowState.Minimized). Everything else in the form seems to work fine up to this point.

Any ideas?

Thanks,
Andrea
 
I'm getting this same error, what did you figure out?

Dman...
 
The error wasn't actually occurring on the me.close(), even though that is how it appeared when I stepped through the program in debug. When I closed this form, I was really getting an error on a DataSet when another form was Activated.

The reason I didn't find it earlier was that the debugger was not showing me that the code in the Activated Sub was executing, even though I was stepping through line by line. It appeared to skip the code in the Activated Sub, but was still executing it. I had to put a breakpoint at the beginning of every Sub and Function to figure out what was getting executed when the form closed.

I don't know if this is a setting I have incorrect in the IDE that is causing this, or something else.

Andrea
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top