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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot Access a disposed object

Status
Not open for further replies.

GlynA

Programmer
May 1, 2002
77
GB
I have a project with a sub main & two forms (form1 & form2).
the sub main does application.run (x) where x is an instance of form2.
In the load event of form2 there is logic to show form1 as a dialog and if it returns cancel then it does me.close to terminate the application.
This works fine unless form2 contains an activex control.
In this case I get an error 5 from the application.run with the description "Cannot access a disposed object named Form2".

Has anyone else come across this bug? At present I am using error handling to ignore the error which occurs. Has anyone a better work-around?

Thanks for your help.

Glyn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top