Click here to Skip to main content
15,879,239 members
Home / Discussions / C#
   

C#

 
AnswerRe: Looping through a CSV with threads Pin
Luc Pattyn31-Jan-10 16:26
sitebuilderLuc Pattyn31-Jan-10 16:26 
GeneralRe: Looping through a CSV with threads Pin
PIEBALDconsult31-Jan-10 17:05
mvePIEBALDconsult31-Jan-10 17:05 
GeneralRe: Looping through a CSV with threads Pin
Luc Pattyn31-Jan-10 17:19
sitebuilderLuc Pattyn31-Jan-10 17:19 
GeneralRe: Looping through a CSV with threads Pin
Danpeking31-Jan-10 23:00
Danpeking31-Jan-10 23:00 
GeneralRe: Looping through a CSV with threads Pin
Luc Pattyn1-Feb-10 1:40
sitebuilderLuc Pattyn1-Feb-10 1:40 
AnswerRe: Looping through a CSV with threads Pin
#realJSOP31-Jan-10 23:51
mve#realJSOP31-Jan-10 23:51 
AnswerRe: Looping through a CSV with threads Pin
Dan Mos1-Feb-10 5:37
Dan Mos1-Feb-10 5:37 
AnswerRe: Looping through a CSV with threads Pin
Danpeking3-Feb-10 1:08
Danpeking3-Feb-10 1:08 
Thank you very much for the replies.
I created 10 threads and broke down my file into 10 files. Each thread would loop through then.
This is what I went with in the end:

private void btnRun_Click(object sender, EventArgs e)
{
for (int i = 0; i < threadCount; i++)
{
CreateThread(i);
}
}

private void CreateThread(int threadID)
{
Thread thread = new Thread(new ParameterizedThreadStart(RunProcess));
thread.Start(threadID);
lstThread.Add(thread);
}

private void RunProcess(object threadID)
{
int id = (int)threadID;

for (int i = id; i < threadCount; i += threadCount)
{
ProcessByThread(Convert.ToInt32(threadID));
}
lstThread[id].Abort();
}

private void ProcessByThread(int threadNumber)
{
GetDataFromCsv("Batch" + threadNumber + ".csv", threadNumber);
}
Questionwpf Pin
mehrdad33331-Jan-10 12:52
mehrdad33331-Jan-10 12:52 
AnswerRe: wpf Pin
Not Active31-Jan-10 13:20
mentorNot Active31-Jan-10 13:20 
AnswerRe: wpf Pin
Pete O'Hanlon31-Jan-10 22:27
mvePete O'Hanlon31-Jan-10 22:27 
Questionproblem by local ip Pin
mehrdad33331-Jan-10 12:41
mehrdad33331-Jan-10 12:41 
AnswerMessage Closed Pin
31-Jan-10 21:36
stancrm31-Jan-10 21:36 
GeneralRe: problem by local ip Pin
mehrdad3331-Feb-10 6:55
mehrdad3331-Feb-10 6:55 
QuestionWPF Interoperability problem Pin
newstargate31-Jan-10 12:22
newstargate31-Jan-10 12:22 
AnswerRe: WPF Interoperability problem Pin
Not Active31-Jan-10 13:22
mentorNot Active31-Jan-10 13:22 
AnswerRe: WPF Interoperability problem Pin
Pete O'Hanlon31-Jan-10 23:04
mvePete O'Hanlon31-Jan-10 23:04 
Questionnetwork programming Pin
hotthoughtguy31-Jan-10 9:18
hotthoughtguy31-Jan-10 9:18 
AnswerRe: network programming Pin
Abhinav S31-Jan-10 10:07
Abhinav S31-Jan-10 10:07 
AnswerRe: network programming Pin
mehrdad33331-Jan-10 12:48
mehrdad33331-Jan-10 12:48 
AnswerRe: network programming Pin
Rod Kemp31-Jan-10 19:10
Rod Kemp31-Jan-10 19:10 
QuestionHow do delegates work? Pin
Neo1010131-Jan-10 9:12
Neo1010131-Jan-10 9:12 
AnswerRe: How do delegates work? Pin
Abhishek Sur31-Jan-10 9:55
professionalAbhishek Sur31-Jan-10 9:55 
GeneralRe: How do delegates work? Pin
Neo1010131-Jan-10 10:12
Neo1010131-Jan-10 10:12 
AnswerRe: How do delegates work? Pin
PIEBALDconsult31-Jan-10 15:25
mvePIEBALDconsult31-Jan-10 15:25 

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.