Click here to Skip to main content
15,994,406 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to read binary file with dvi extension. Pin
DaveyM6927-Jan-10 13:00
professionalDaveyM6927-Jan-10 13:00 
Questionapplication start from file open request? Pin
Mark H Bishop27-Jan-10 11:29
Mark H Bishop27-Jan-10 11:29 
AnswerRe: application start from file open request? Pin
Luc Pattyn27-Jan-10 12:20
sitebuilderLuc Pattyn27-Jan-10 12:20 
AnswerRe: application start from file open request? Pin
Dan Mos27-Jan-10 12:22
Dan Mos27-Jan-10 12:22 
GeneralRe: application start from file open request? Pin
Mark H Bishop28-Jan-10 9:48
Mark H Bishop28-Jan-10 9:48 
QuestionForm Not Closing Pin
Wamuti27-Jan-10 11:10
Wamuti27-Jan-10 11:10 
AnswerRe: Form Not Closing Pin
DaveyM6927-Jan-10 11:13
professionalDaveyM6927-Jan-10 11:13 
AnswerRe: Form Not Closing Pin
Jimmanuel27-Jan-10 11:22
Jimmanuel27-Jan-10 11:22 
You need to tell the thread to stop so that it can cleanup its resources and exit:

[RE-EDIT]
bool runListener = true;
private void StartListening()
{
      listener.Start();
      while (runListener)
      {
           if (listener.Pending())
           {
                 Networks user = new Networks(listener.AcceptTcpClient());
           }
           else
           {
                 Thread.Sleep(250); // sleep for a bit to not hog the processor
           }
      }
      listener.Stop();
}

then in the FormClosing event (or wherever you're doing cleanup) set runListener to false.

Also, if you set the thread's IsBackground property to true then the thread won't cause the program to remain alive even if it isn't terminated before the form closes.

Control.CheckForIllegalCrossThreadCalls = false;
And that's just completely uncalled for.

Badger | [badger,badger,badger,badger...]

GeneralRe: Form Not Closing Pin
Wamuti27-Jan-10 11:29
Wamuti27-Jan-10 11:29 
GeneralRe: Form Not Closing Pin
Jimmanuel27-Jan-10 11:35
Jimmanuel27-Jan-10 11:35 
GeneralRe: Form Not Closing Pin
Wamuti27-Jan-10 11:39
Wamuti27-Jan-10 11:39 
QuestionSppech to text & Text to speech Pin
SajjadZare27-Jan-10 9:08
SajjadZare27-Jan-10 9:08 
AnswerRe: Sppech to text & Text to speech Pin
Jimmanuel27-Jan-10 9:42
Jimmanuel27-Jan-10 9:42 
Questionhelp Pin
hu_kh0027-Jan-10 8:20
hu_kh0027-Jan-10 8:20 
AnswerRe: help Pin
hammerstein0527-Jan-10 8:39
hammerstein0527-Jan-10 8:39 
GeneralRe: help Pin
hammerstein0527-Jan-10 9:39
hammerstein0527-Jan-10 9:39 
GeneralRe: help Pin
DaveyM6927-Jan-10 12:11
professionalDaveyM6927-Jan-10 12:11 
AnswerRe: help Pin
Eddy Vluggen27-Jan-10 8:48
professionalEddy Vluggen27-Jan-10 8:48 
AnswerRe: help Pin
DaveyM6927-Jan-10 9:18
professionalDaveyM6927-Jan-10 9:18 
GeneralRe: help Pin
Luc Pattyn27-Jan-10 9:35
sitebuilderLuc Pattyn27-Jan-10 9:35 
AnswerRe: help Pin
harold aptroot27-Jan-10 9:21
harold aptroot27-Jan-10 9:21 
QuestionProblem with events... Pin
Kaikus27-Jan-10 5:17
Kaikus27-Jan-10 5:17 
AnswerRe: Problem with events... Pin
PIEBALDconsult27-Jan-10 5:28
mvePIEBALDconsult27-Jan-10 5:28 
AnswerRe: Problem with events... Pin
N a v a n e e t h27-Jan-10 5:33
N a v a n e e t h27-Jan-10 5:33 
AnswerRe: Problem with events... Pin
hammerstein0527-Jan-10 7:27
hammerstein0527-Jan-10 7:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.