Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

Showing a nonmodal form only once

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Edgardo Rossetto - 24 Feb 2005 06:47 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.