Click here to Skip to main content
15,894,297 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have code:

C#
ThreadStart start = new ThreadStart(Temp);
arrayThread[i] = new Thread(start);

arrayThread[i].Start();


but when i build: error:

A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.


help me!!!
Posted
Updated 12-Mar-15 17:49pm
v2

1 solution

Your report is not true. The project cannot build. Therefore, you could not observe "A problem caused the program to stop working correctly…" message.

The code cannot build because, in second line, left and right parts are of different assignment-incompatible type, left is the array of elements of some element type, right part's type is System.Threading.Thread. It all makes no sense at all.

—SA
 
Share this answer
 
Comments
Ton162 12-Mar-15 22:39pm    
I don't understand. can you explain more clearly?
Sergey Alexandrovich Kryukov 12-Mar-15 22:58pm    
Yes, I can. What part of it.
When I said "left part", I meant "arrayThread[i]". "Right part": "new Thread(start)". What could possibly be unclear?
—SA
Ton162 12-Mar-15 22:41pm    
Thread[] arrayThread = new Thread[array.Length];
for (int i = 0; i < arrayThread.Length; i++)
{
_text2 = arrayTable[i];

//ThreadStart start = new ThreadStart(Temp);
arrayThread[i] = new Thread(Temp);

arrayThread[i].Name = "Thread" + arrayTable[i];
arrayThread[i].Start();
}
Sergey Alexandrovich Kryukov 12-Mar-15 22:58pm    
And..?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900