PC Review


Reply
Thread Tools Rate Thread

Closing all dialogs on logout

 
 
Joshua T. Moore
Guest
Posts: n/a
 
      23rd Feb 2005
Here is the layout to understand the problem:
Application.Run calls LogonDlg.cs
LogonDlg (if login successful) opens Form1.cs
Form1.cs opens Form2.cs

I have an app where a network packet received on a socket logs out the user
back to the login screen. This works great if the form1 is the active one,
but if I open form2 (showDialog()) and the packet comes in, the form1 sets
form2 to null, and gets an "Argument Excpeption" when the form1 tries to set
it's DialogResult and return to LogonDlg.

Please help.

Thanks,
Joshua Moore


 
Reply With Quote
 
 
 
 
Sergey Bogdanov
Guest
Posts: n/a
 
      24th Feb 2005
Have you tried to call form2.Dispose() instead of form2 = null?

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com


Joshua T. Moore wrote:
> Here is the layout to understand the problem:
> Application.Run calls LogonDlg.cs
> LogonDlg (if login successful) opens Form1.cs
> Form1.cs opens Form2.cs
>
> I have an app where a network packet received on a socket logs out the user
> back to the login screen. This works great if the form1 is the active one,
> but if I open form2 (showDialog()) and the packet comes in, the form1 sets
> form2 to null, and gets an "Argument Excpeption" when the form1 tries to set
> it's DialogResult and return to LogonDlg.
>
> Please help.
>
> Thanks,
> Joshua Moore
>
>

 
Reply With Quote
 
Joshua T. Moore
Guest
Posts: n/a
 
      24th Feb 2005
Yes,

I tried the following code per dialog that was not null:

if (form2 != null)
{
form2.DialogResult = DialogResult.Cancel;
form2.Dispose();
form2 = null;
}

the "Argument Exception" comes when I try to set the form1 dialogresult to
ok.

Thanks for the suggestion,
Josh

"Sergey Bogdanov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Have you tried to call form2.Dispose() instead of form2 = null?
>
> Best regards,
> Sergey Bogdanov
> http://www.sergeybogdanov.com
>
>
> Joshua T. Moore wrote:
>> Here is the layout to understand the problem:
>> Application.Run calls LogonDlg.cs
>> LogonDlg (if login successful) opens Form1.cs
>> Form1.cs opens Form2.cs
>>
>> I have an app where a network packet received on a socket logs out the
>> user back to the login screen. This works great if the form1 is the
>> active one, but if I open form2 (showDialog()) and the packet comes in,
>> the form1 sets form2 to null, and gets an "Argument Excpeption" when the
>> form1 tries to set it's DialogResult and return to LogonDlg.
>>
>> Please help.
>>
>> Thanks,
>> Joshua Moore



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logout/login w/o closing Access Army MI Microsoft Access Security 1 4th May 2009 04:28 PM
.NET bug? Closing Top Form Shown with ShowDialog? Closes Alll Dialogs? Dachshund Digital Microsoft VB .NET 1 9th Dec 2005 01:15 PM
Checking for logout when closing a form? Andy Pickering Microsoft Dot NET Framework Forms 6 14th Apr 2005 07:22 PM
Implementing logout without closing access =?Utf-8?B?ViBSYW1vcw==?= Microsoft Access Security 1 8th Mar 2005 09:13 AM
Shutdown / Logout aborts when closing application Robert Microsoft Windows 2000 Developer 2 30th Mar 2004 07:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 PM.