DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 22 Aug 2007 17:46:00 -0700,    posted on: microsoft.public.dotnet.framework.windowsforms        back       

Thread Index
  1    jdkc4d
          2    AlexS LEASE


Windows Forms + System.Threading   
I am working on a program where I need 2 things to happen at the same time.  
The form needs to load and at the same time I want to start a timer which 
after a certain amount of time kills the entire application.  The user has to 
click submit on the form within 2 minutes, or else I want something else to 
happen.  For example, lets say I want a form to open and say the computer is 
going to logoff in 2 minutes.  The user can select logoff now, or the user 
can ignore the form, in which case the form logs off after 2 minutes.  I have 
tried using the System.Threading.Timers, with the Wait.Any method, but I 
don't seem to be able to use that with Application.Run, which causes one of 
the two things to happen but not both at the same time.  Does anyone have any 
suggestions?
Date:Wed, 22 Aug 2007 17:46:00 -0700   Author:  

Re: Windows Forms + System.Threading   
If this is just timer, kick it off during form load and handle tick event in 
the form code. You can always use Close method to close the form.
If it is "something else" then kick off another thread - again during form 
load and have some form event ready to handle completion of that 
"something". You can use BackgroundWorker and it's RunWorkerCompleted event 
to handle completion of submitted thread.


"jdkc4d"  wrote in message 
news:F5D45C1C-C77F-4A93-8CD9-3081F10222FF@microsoft.com...

>I am working on a program where I need 2 things to happen at the same time.
> The form needs to load and at the same time I want to start a timer which
> after a certain amount of time kills the entire application.  The user has 
> to
> click submit on the form within 2 minutes, or else I want something else 
> to
> happen.  For example, lets say I want a form to open and say the computer 
> is
> going to logoff in 2 minutes.  The user can select logoff now, or the user
> can ignore the form, in which case the form logs off after 2 minutes.  I 
> have
> tried using the System.Threading.Timers, with the Wait.Any method, but I
> don't seem to be able to use that with Application.Run, which causes one 
> of
> the two things to happen but not both at the same time.  Does anyone have 
> any
> suggestions?
> 
Date:Wed, 22 Aug 2007 21:40:02 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us