"cannot access disposed object named"

  • Thread starter Ravindra Tripathi
  • 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
 
C

Cor Ligthert [MVP]

Ravindra,

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

Cor
 
R

Ravindra Tripathi

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
 
C

Cor Ligthert [MVP]

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

Top