At the moment, the code you have is telling the program to close itself when it loads (hence the opening/closing door analogy). Perhaps you meant to run this code in a different event? Like a button click?
The code you have at the moment doesn't make sense at all. I think that's what the error is trying to tell you; "I can't load when I'm closing".
Well you all are right with the concept of a code, but he is probably a beginner
As me and I believe what is trying to say is: suppose you want to run a form just for few seconds and it closes by itself,
Eg: a welcome note, on load it opens a form and closes to open the principal one.
I am keen to know how itís done in Visual studio 2008 0r 2010.
You would close it on some event, not the 'Load' event.
Maybe create a Timer with the delay of a couple seconds, listen to the Elapsed event of the Timer and close the form during that event.
Or maybe close it on a specific button click. Like an 'OK' button.
Or close it after some task you've done is complete. Say you use this time to load up a bunch of resources, then when done you close the form.
Really though all of these require some extra info to accomplish. But the actual closing is occurring on some 'event'. Hence everyone referring to the choice in event, you wouldn't close during an open event, that's just illogical.