"cannot access disposed object named"

  • Thread starter Thread starter Ravindra Tripathi
  • Start date Start date
R

Ravindra Tripathi

Hi

I have a form with a textbox and a close button.
whenever I try to close the the form i get an exception
"cannot access disposed object named"

how do i correct this issue?

Ravindra
 
Ravindra,

Do you have beside that textbox and button as well code written by you in
your program?

Cor
 
Yeah there is some code for the close button clicked event.

Apart from that I am parsing a XML, and using the values obtained from XML
to populate the textbox.

Private Sub cmdClose_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdCancel.Click


Me.Hide()

Me.Close() 'This is the point where the codes stops and gives the exception
"cannot access disposed object named TextBox"


End Sub
 
Ravindra,

Although this is in my opinion not the error

Why do you hide your form for closing, do you think the user can see that
nanosecond, it will make the closing time in fact longer?

I am curious if you have more of this kind not necessary code in your
program.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Disposed form still responds to events 2
Object disposal guidance needed 13
Dispose and CreateHandle 0
Dispose Question (VB.NET 2003) 6
to dispose or not ? 67
Help! 2
Disposed Object 3
MDI Icon dispose error? 0

Back
Top