Hi Robert,
This is actually expected behavior. You are not able to close a form
that's been disabled due to a modal dialog while that modal dialog is still
open.
What you're doing now is fine. Depending on your scenario, you may also
want to consider 'Application.Exit' which will quit your modal dialog loop
as well as your main Application.Run loop (typically used for critical
error situations). Application.Exit is more of a forced shutdown, where as
closing forms is more graceful.
-Katie
This posting is provided "AS IS" with no warranties, and confers no rights.
***.Net Compact Framework Info***
Faq:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.a
spx
QuickStarts:
http://samples.gotdotnet.com/quickstart/CompactFramework/
Samples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/h
tml/CompactfxTechArt.asp
--------------------
| Reply-To: "Robert Lalouche" <
[email protected]>
| From: "Robert Lalouche" <
[email protected]>
| References: <
[email protected]>
<O#
[email protected]>
| Subject: Re: How do I close an old form from a new form in C#?
| Date: Wed, 21 Jan 2004 20:11:04 -0500
| Lines: 39
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: dhcp024-160-199-155.ma.rr.com 24.160.199.155
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFTNGXA0
5.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.framework.compactframework:43682
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| We are using ShowDialog to start the FormTwo from FormOne, and trying as
you
| suggest to Close() FormOne from FormTwo causes a ArgumentException. We
| realized that the problem is FormTwo is Modal, so FormOne is disabled.
| However, calling FormTwo Modeless introduced other problems. For now, we
| call FormOne.Close() immmediatley after the ShowDialog in FormOne, which
now
| works, but with less flexibility. Thanks.
| -Robert
|
| "Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in message
| | > How is it a different UI thread? There can only be one UI thread in an
| app.
| > Can you show how you're trying to close it? You should only need a
| > reference to the instance and then call Close().
| >
| > -Chris
| >
| > | > > My program has multiple forms that call each other in progression.
| > FormOne
| > > has a menu option to Create FormTwo. When I'm done with FormTwo and
| close
| > > it, there is FormOne still running. I'd like to beable to close
FormTwo
| > > from within FormOne. I've tried using Invoke since it's a different
UI
| > > thread - it seems like I have syntax correct, but keep getting
| > > ArgumentException? Can anyone help me avoid re-inventing the wheel?
| > Thank
| > > you.
| > >
| > > --
| > > Robert Lalouche
| > > ObTech
| > >
| > >
| >
| >
|
|
|