C # Importing multiple txt files running

I wrote a piece of code to read the contents of many text files from a specific directory.

I know I posted incomplete code, so the help I get is limited, however I am asking this question so I can find out what I am doing wrong with my code, wrong I can get a simple copy and paste solution.

All the text files that I want to receive are set up exactly the same. I then export this data to a separate text file "ImportedUsers.txt", which lists all users along with their first name, last name, full name, company, and notes. At this point, the first file is being imported correctly, however, for any additional files, the data is mixed and if the full name is left blank, the company then ends up in the Notes field.

Any help is greatly appreciated.

+3


source to share


1 answer


Will this work when moving your variable definition

int numComma = 0;

      

inside the loop:



for (int intFileNameNumber = 0; intFileNameNumber < importFileFormat.Length; intFileNameNumber++)

      

so you can count the number of commas separately for each file.

I would suggest separating the file import and export logic, it looks very difficult to read :)

+5


source







All Articles