|
-
Jan 18th, 2012, 10:31 AM
#1
Thread Starter
Hyperactive Member
Difficulty accessing 'disposed' form
I'm having a strange difficulty. Here is the order of events:
- User presses button on form1
- New Form object is created for from 2
- New form object '.show' command is fired
- Form 2 opens correctly
- In the Load Event of Form 2, the form attempts to do various things in a try, catch, finally clause
- On catch, I close form2 down '.close' as it cannot be used as something has gone wrong with the execution
However, my problem is this. It is acceptable for things to go wrong on the from 2 load event which is why I have implemented the try - catch functionality. However, when I close the form2 down as a result of the problem, a real error ocurrs 'Cannot access a disposed object' and the VB IDE refers me to Form1's '.show' event for Form2.
It is almost as if the form hasn't fully 'shown' before I am closing it down. Does anyone have any idea what the problem is here? Do I need to close down Form2 ourside of it's Load event handler so that Form1 thinks it has loaded correctly?
Cheers!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|