Error in Calling..the same form again

  • Thread starter Thread starter Taposh Dutta Roy
  • Start date Start date
T

Taposh Dutta Roy

Hello ,
I am developing an application using objects where my
object gets updated from a second form. when I update the
object the first time it works fine but when I reload it
using frm.showdialog it gives me an error
system.argument..error and invalid Parameter Used. I am
unable to find out the reason. also in the form
constructor new i am overloading it and passing my object.
any suggestions
 
That should be OK, so long as you recreate the form with new.

The question is if you disposed the object you passed. You are passing just
a reference to that object. So if you modified that object in such a way
that it could be disposed, or explicitly disposed it, and then try to pass
it again, you'll get an invalid parameter.

The easiest way to check it is to add a breakpoint where you show the
dialogue again. Do a quick watch on your object right before you show the
dialogue.
 
Hello Justin
the object is disposed after update. So, now for 2nd time
when I call new form and do form.showdialog it means I am
calling the old object again.What do I do now.
Taposh
 
If you needed that original object with its data, you need to prevent it
from being disposed. You need to find out why and where it's being
disposed.

If you don't care what the original information was - it's a utility object
you're recreating each time - create it again with new.

You really should pinpoint where that object is being disposed. You want to
understand why it's happening.
 
Back
Top