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 / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

How to programatically close a form which has a Font/Color Dialog     opened

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aagarwal8@gmail.com - 21 Mar 2008 11:41 GMT
Hi,

I have a form (say FormB) on which i have opened a font dialog. There
are situations when i need to close FormB, from another form (say
FormA) in my application. i am calling FormB.Close(), but the form
doesn't close. The moment i close the Font Dialog, FormB gets closed.
(Also, I observe the same behavior when i open other forms using
ShowDialog from FormB)

I need to find a way so that FormB closes as soon as i call
FormB.Close();

Regards,
Ankit
Andy - 21 Mar 2008 14:55 GMT
On Mar 21, 6:41 am, aagarw...@gmail.com wrote:
> Hi,
>
[quoted text clipped - 10 lines]
> Regards,
> Ankit

I don't think this is possible.  The only way it would work is if you
could somehow tell the modal dialog to close, and I'm not sure of a
way to get that.
aagarwal8@gmail.com - 24 Mar 2008 07:23 GMT
> On Mar 21, 6:41 am, aagarw...@gmail.com wrote:
>
[quoted text clipped - 16 lines]
> could somehow tell the modal dialog to close, and I'm not sure of a
> way to get that.

Any, i have opened FormB on a separate thread. so i can have FormB
blocked with a modal dialog, but can still work on FormA (and thereby
initiate a close of FormB)

Regards,
Ankit
Peter Duniho - 24 Mar 2008 08:22 GMT
>> I don't think this is possible.  The only way it would work is if you
>> could somehow tell the modal dialog to close, and I'm not sure of a
[quoted text clipped - 3 lines]
> blocked with a modal dialog, but can still work on FormA (and thereby
> initiate a close of FormB)

Be that as it may, I agree with Andy that closing another form that's  
otherwise blocked by a modal dialog is not in keeping with the very  
excellent user-interface design "rule of least surprise".

If you really want to do this, you need to close the modal dialog first  
(as Andy already said).  Then you can close the form that opened the modal  
dialog.  Not that this is all that much nicer to the user, but at least  
it's less surprising than a form underneath a modal dialog disappearing  
while the modal dialog sticks around doing who knows what.

Pete
aagarwal8@gmail.com - 25 Mar 2008 12:05 GMT
On Mar 24, 12:22 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> >> I don't think this is possible.  The only way it would work is if you
> >> could somehow tell the modal dialog to close, and I'm not sure of a
[quoted text clipped - 15 lines]
>
> Pete

Pete,

I dont just want to close the FormB, but also the modal dialog/form
blocking it.
So it will never be a situation that the form disappears from the
background, and the modal window stands thr orphaned.

Ankit!
Peter Duniho - 25 Mar 2008 17:39 GMT
> I dont just want to close the FormB, but also the modal dialog/form  
> blocking it.

Then perhaps you could be more clear about what's giving you trouble.  
Posting a concise-but-complete code sample would be a good starting  
point.  What about closing the two forms are you having a hard time  
figuring out?

Pete
ignacio machin - 21 Mar 2008 15:39 GMT
On Mar 21, 6:41 am, aagarw...@gmail.com wrote:
> Hi,
>
[quoted text clipped - 10 lines]
> Regards,
> Ankit

Hi,

if the dialog is modal, how are you gonna clse it from another form?
Not only that, but IMHO closing a form without the user consent (or as
a response to an user action) is rude, very rude

Rate this thread:







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.