Hi, I'm having this little issue which i dont know how to fix properly.
I have a button that instanciates a form, then it shows it normally (not
modal), this opened form is owned by the main form, the problem is that
I dont know how to check if it was previously openeded (the owned form).
So i made a private bool field in the main form indicating weather the
owned form is opened or not, so far thats good.
My question is if my owned form is implicitly aware of the instance of
the owner form, that is, if I can change public/protected properties
from the owned form, of if I need to pass by ref the instance of the
owner to the owned form constructor.
You see, I dont want to create unnecessary references if possible.
Thanks,
Edgardo
Edgardo Rossetto - 24 Feb 2005 09:11 GMT
Is there a "by the book" way of doing this?
Wayne - 24 Feb 2005 13:49 GMT
You could keep a reference to the instance of the new form, so the next time
the user presses the button you just call Var.Show(); To know when the new
form is closed, create a method in the owner form and assign it to the new
forms Close Event.

Signature
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
> Hi, I'm having this little issue which i dont know how to fix properly.
>
[quoted text clipped - 14 lines]
> Thanks,
> Edgardo
saurabh - 25 Feb 2005 16:20 GMT
Instead of creating the form everytime, you could create it only once and
then wherever the user closes it, just hide the form but don't close it.
When its requested again, show it to the user.
> Hi, I'm having this little issue which i dont know how to fix properly.
>
[quoted text clipped - 14 lines]
> Thanks,
> Edgardo
Nicholas Cardi - 28 Feb 2005 14:24 GMT
You could use the singleton patten to accomplish this. In doing so you can
treat the form as if it was a normal form.
Google Singleton Pattern C# or VB.Net
Best of luck
Nick
> Hi, I'm having this little issue which i dont know how to fix properly.
>
[quoted text clipped - 14 lines]
> Thanks,
> Edgardo