Newbie Question

  • Thread starter Thread starter Kfir M
  • Start date Start date
K

Kfir M

Hi,
I made a new application form, but when I close the form the process is
still up and showing at the task manager.
How do i dispose of the process correctly?

Thanks in advance.
 
If your form is displayed using

Application.Run(new Form1());

then just just closing it (this.Close();) normally shuts down the
application.

===================
Clay Burch
Syncfusion, Inc.
 
I did'n't know but I needed to close all other threads before closing the
main form.
 
Do you have any other forms still open?

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
 
I did'n't know but I needed to close all other threads before closing the
main form.

Sort of. Technically, you need to close all other threads that are not
marked as "background" threads. Any threads you create explicitly will,
by default, not be background threads and you're right that you need to
let those threads exit before your application will exit.

But there are plenty of other threads around, even if you didn't ask them
to be, that don't prevent your application from closing (because they are
background threads).

Pete
 
Environment.Exit(0); will close all child threads from the main application.
 
I did'n't know but I needed to close all other threads before closing the
main form.

If you want the other threads to end when your main form closes, just
set them to be background threads. I think the property is something
like "IsBackground = true" on your Thread instance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top