Click here to Skip to main content
15,891,204 members
Home / Discussions / C#
   

C#

 
AnswerRe: My dynamic table will not display... Pin
Chip Long20-Jan-09 9:51
Chip Long20-Jan-09 9:51 
QuestionLogic/Syntax for shifting all items in List<string> by +1 place</string> Pin
Abydosgater19-Jan-09 11:02
Abydosgater19-Jan-09 11:02 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
Pete O'Hanlon19-Jan-09 11:08
mvePete O'Hanlon19-Jan-09 11:08 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
DaveyM6919-Jan-09 11:24
professionalDaveyM6919-Jan-09 11:24 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
User 665819-Jan-09 11:37
User 665819-Jan-09 11:37 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
Luc Pattyn19-Jan-09 12:08
sitebuilderLuc Pattyn19-Jan-09 12:08 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
Mark Churchill19-Jan-09 13:07
Mark Churchill19-Jan-09 13:07 
QuestionThreads / Class / Array Pin
Planker19-Jan-09 9:51
Planker19-Jan-09 9:51 
I have a form that gets a list of files for processing I am storing the path in an sting array then passing the array to a class that does the work on the files. the single thread approach takes about 30 mins to process 100 files and update an access DB (will be ported to SQL soon). Currently the single thread makes the form not responsive. I want to at a minimum move the processing to another thread, possibly setup a thread pool. from what I can tell the time consuming part is updating the DB. I have a few questions before I jump to conclusion of adding 1 thread or a thread pool.

1. will the thread pool solution run into locked file problems when writing to the DB from multiple threads? currently using Jet OLEDB to connect to the DB
2. What is the best way to handle passing the files to the class with threads?
Currently I am reading the directory and storing the files in a string array in the form
creating the object for the class
passing the array to the StoreArray method
call the Process method

the process method calls another method that handles the interaction with the array

I think the answer to my 2nd question with the least amount of rewriting code is to create the object of the class as a form variable, but I'm not sure that that is really the best solution.

I'm new to threads and not sure how I can get the data from the Form to the class.

below is two of the methods that should show how i am currently doing this (could have errors I didn't cut and paste)

## form1 ###

private void btnStart_Click(object sender, EventArgs e)
{
int count = 0;
string dirpath = this.txtxmldir.Text.ToString();
if (dirpath != "")
{
//new Dir Info object
DirectoryInfo di = new DirectoryInfo(dirpath);
//load files into array
FileInfo[] rgFiles = di.GetFiles("*.xml");
foreach (FileInfo fi in rgFiles)
{
file[count] = dirpath + "\\" + fi.Name;
count++;
}
}
RRRxml ProcessXml = new RRRxml();
ProcessXml.SetFiles(file, count);
ProcessXml.Process();
}

## RRRxml Class ###

public void Process()
{
while(Arraycounter > 0)
{
string FiletoProcess = ReadFiles(); //Read files is in charge of controlling the array counter and returns the file to load
xml.Load(FiletoProcess);
//Do work....
}
}
AnswerRe: Threads / Class / Array Pin
SeMartens19-Jan-09 21:27
SeMartens19-Jan-09 21:27 
QuestionHow create professional docu? Pin
Frygreen19-Jan-09 8:49
Frygreen19-Jan-09 8:49 
AnswerRe: How create professional docu? Pin
Eddy Vluggen19-Jan-09 9:07
professionalEddy Vluggen19-Jan-09 9:07 
AnswerRe: How create professional docu? Pin
Colin Angus Mackay19-Jan-09 10:27
Colin Angus Mackay19-Jan-09 10:27 
AnswerRe: How create professional docu? Pin
Not Active19-Jan-09 10:33
mentorNot Active19-Jan-09 10:33 
AnswerRe: How create professional docu? Pin
Frygreen20-Jan-09 8:05
Frygreen20-Jan-09 8:05 
Questionread byte[] from file, save byte[] in new file, different size Pin
arturw8219-Jan-09 8:22
arturw8219-Jan-09 8:22 
AnswerRe: read byte[] from file, save byte[] in new file, different size Pin
Jimmanuel19-Jan-09 9:46
Jimmanuel19-Jan-09 9:46 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
arturw8219-Jan-09 10:01
arturw8219-Jan-09 10:01 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
Jimmanuel19-Jan-09 10:25
Jimmanuel19-Jan-09 10:25 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
arturw8220-Jan-09 6:23
arturw8220-Jan-09 6:23 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
Jimmanuel20-Jan-09 7:12
Jimmanuel20-Jan-09 7:12 
QuestionProgramming Web In C# Pin
trinm198719-Jan-09 7:45
trinm198719-Jan-09 7:45 
AnswerRe: Programming Web In C# Pin
EliottA19-Jan-09 9:28
EliottA19-Jan-09 9:28 
AnswerCP IGNORE USER...THIRD time he's posted this. Pin
leckey19-Jan-09 10:20
leckey19-Jan-09 10:20 
QuestionPrint Start event Pin
spiritboy19-Jan-09 7:30
spiritboy19-Jan-09 7:30 
QuestionDeveloping a small DBMS software tool Pin
Calma19-Jan-09 7:27
Calma19-Jan-09 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.