Click here to Skip to main content
15,917,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: is it possible to do this? Pin
Dan Mos1-Mar-10 12:32
Dan Mos1-Mar-10 12:32 
GeneralRe: is it possible to do this? Pin
tonyonlinux1-Mar-10 13:36
tonyonlinux1-Mar-10 13:36 
GeneralRe: is it possible to do this? Pin
tonyonlinux1-Mar-10 15:30
tonyonlinux1-Mar-10 15:30 
GeneralRe: is it possible to do this? Pin
Dan Mos2-Mar-10 1:25
Dan Mos2-Mar-10 1:25 
Questionconnect to a mysql database w/out using mysql connector??? Pin
andyxfun1-Mar-10 7:58
andyxfun1-Mar-10 7:58 
AnswerRe: connect to a mysql database w/out using mysql connector??? Pin
snorkie1-Mar-10 8:17
professionalsnorkie1-Mar-10 8:17 
AnswerRe: connect to a mysql database w/out using mysql connector??? Pin
Saksida Bojan1-Mar-10 8:24
Saksida Bojan1-Mar-10 8:24 
AnswerRe: connect to a mysql database w/out using mysql connector??? Pin
Som Shekhar1-Mar-10 8:46
Som Shekhar1-Mar-10 8:46 
Question"Event" is null while invoking custom event Pin
Arindam Tewary1-Mar-10 7:27
professionalArindam Tewary1-Mar-10 7:27 
AnswerRe: "Event" is null while invoking custom event [modified] Pin
Saksida Bojan1-Mar-10 7:34
Saksida Bojan1-Mar-10 7:34 
GeneralRe: "Event" is null while invoking custom event (Solved) Pin
Arindam Tewary1-Mar-10 7:51
professionalArindam Tewary1-Mar-10 7:51 
GeneralRe: "Event" is null while invoking custom event (Solved) Pin
OriginalGriff1-Mar-10 8:21
mveOriginalGriff1-Mar-10 8:21 
GeneralRe: "Event" is null while invoking custom event (Solved) Pin
Arindam Tewary1-Mar-10 8:29
professionalArindam Tewary1-Mar-10 8:29 
GeneralRe: "Event" is null while invoking custom event (Solved) Pin
Saksida Bojan1-Mar-10 8:47
Saksida Bojan1-Mar-10 8:47 
GeneralRe: "Event" is null while invoking custom event (Solved) Pin
Luc Pattyn1-Mar-10 9:32
sitebuilderLuc Pattyn1-Mar-10 9:32 
GeneralRe: "Event" is null while invoking custom event (Solved) Pin
Saksida Bojan1-Mar-10 9:51
Saksida Bojan1-Mar-10 9:51 
AnswerRe: "Event" is null while invoking custom event Pin
Luc Pattyn1-Mar-10 7:49
sitebuilderLuc Pattyn1-Mar-10 7:49 
GeneralRe: "Event" is null while invoking custom event Pin
Arindam Tewary1-Mar-10 7:57
professionalArindam Tewary1-Mar-10 7:57 
GeneralRe: "Event" is null while invoking custom event Pin
DaveyM691-Mar-10 10:32
professionalDaveyM691-Mar-10 10:32 
Questionsafely end a thread Pin
Yustme1-Mar-10 6:54
Yustme1-Mar-10 6:54 
AnswerRe: safely end a thread Pin
Paulo Zemek1-Mar-10 7:07
Paulo Zemek1-Mar-10 7:07 
GeneralRe: safely end a thread Pin
Yustme1-Mar-10 11:45
Yustme1-Mar-10 11:45 
GeneralRe: safely end a thread Pin
Paulo Zemek1-Mar-10 13:53
Paulo Zemek1-Mar-10 13:53 
GeneralRe: safely end a thread Pin
Yustme1-Mar-10 22:31
Yustme1-Mar-10 22:31 
Yes I'm sure. The variable gets checked alright. But it doesn't seem to stop it.

Here is that thread i'm talking about with the code:

private void FileComparerThread()
		{

			while (this.stopRequested != true)
			{

				for (int i = 0; i < Directory.GetFiles(this.dest).Length; i++)
				{
					string[] filePaths = Directory.GetFiles(this.dest, "*.txt");

					for (int j = 0; j < filePaths.Length; j++)
					{ // check if btnCancel has been pressed if so, end this thread.
						if (this.stopRequested != true)
						{
							// check if file names are not the same:
							if (filePaths[i].ToString() != filePaths[j].ToString())
							{
								bool comparedFiles = this.FileCompare(filePaths[i].ToString(), filePaths[j].ToString());

								// move 1 file if they are both the same to another directory
								if (comparedFiles)
									Directory.Move(filePaths[j], Path.Combine(this.dest2, Path.GetFileName(filePaths[j])));
							}
						}

					}
					
					if(filePaths.Length > 3)
						File.Move(filePaths[i], Path.Combine(this.dest, Path.GetFileName(filePaths[i])));
					
					Thread.Sleep(5000);
				}
			}
		}



And then I got a this.FileCompare() function that checks 2 files for equality thats it.

I've done some big time debugging. Its just looping those for statements.
Even though the stopRequested = true.

It's not comming out that for statement.
GeneralRe: safely end a thread Pin
Paulo Zemek2-Mar-10 6:17
Paulo Zemek2-Mar-10 6:17 

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.