unload me in vb 2008

Page 1 of 1

7 Replies - 2929 Views - Last Post: 22 April 2011 - 02:01 PM Rate Topic: -----

#1 fig79  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 25-February 09

unload me in vb 2008

Post icon  Posted 23 September 2009 - 10:57 AM

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Me.Close()
	End Sub 


after the program was executed, warning is come out like this "object Disposed Exception was unhandled"
what's wrong?
Is This A Good Question/Topic? 0
  • +

Replies To: unload me in vb 2008

#2 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 372
  • Joined: 17-July 09

Re: unload me in vb 2008

Posted 23 September 2009 - 03:03 PM

Why are you trying to close the form when it is loading? Its like trying to open a door and trying to close it at the same time.

This post has been edited by PDUNZ: 23 September 2009 - 03:06 PM

Was This Post Helpful? 0
  • +
  • -

#3 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 288
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: unload me in vb 2008

Posted 23 September 2009 - 11:30 PM

PDUNZ. It seems like some people like doing that?

Its amazing what kind of questions appear in these forums sometimes...
Was This Post Helpful? 0
  • +
  • -

#4 CheckersW  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 198
  • Joined: 04-April 09

Re: unload me in vb 2008

Posted 24 September 2009 - 01:09 AM

What are you trying to do this for?

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".
Was This Post Helpful? 0
  • +
  • -

#5 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 91
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: unload me in vb 2008

Posted 24 September 2009 - 02:05 AM

Can you tell us what you are trying to achieve? Like said, your code would theoretically mean when the form loads, it closes at the same time (unrealistic).
Was This Post Helpful? 0
  • +
  • -

#6 lielu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-April 11

Re: unload me in vb 2008

Posted 22 April 2011 - 01:15 PM

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.
Was This Post Helpful? 0
  • +
  • -

#7 lordofduct  Icon User is offline

  • I'm a cheeseburger
  • member icon


Reputation: 2054
  • View blog
  • Posts: 4,049
  • Joined: 24-September 10

Re: unload me in vb 2008

Posted 22 April 2011 - 01:46 PM

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.
Was This Post Helpful? 0
  • +
  • -

#8 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 956
  • View blog
  • Posts: 3,676
  • Joined: 02-July 08

Re: unload me in vb 2008

Posted 22 April 2011 - 02:01 PM

@lielu check out the date of the post before making comments - this thread is very old.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1