Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: calling method/event of one form from another Pin
Sandeep Kalra2-Apr-09 18:09
Sandeep Kalra2-Apr-09 18:09 
Questionnetworkable sign in sign out board C# Pin
Rafone2-Apr-09 6:25
Rafone2-Apr-09 6:25 
AnswerRe: networkable sign in sign out board C# Pin
Skymir2-Apr-09 9:47
Skymir2-Apr-09 9:47 
QuestionCSV File Splitter Help... Pin
Alistair Jarrett2-Apr-09 5:36
Alistair Jarrett2-Apr-09 5:36 
AnswerRe: CSV File Splitter Help... Pin
Judah Gabriel Himango2-Apr-09 5:52
sponsorJudah Gabriel Himango2-Apr-09 5:52 
AnswerRe: CSV File Splitter Help... Pin
Le centriste2-Apr-09 5:52
Le centriste2-Apr-09 5:52 
AnswerRe: CSV File Splitter Help... Pin
DaveyM692-Apr-09 6:02
professionalDaveyM692-Apr-09 6:02 
AnswerRe: CSV File Splitter Help... Pin
riced2-Apr-09 7:05
riced2-Apr-09 7:05 
Something like this ought to do it (assuming you are only splitting by lines and not parsing each line):

do
{
   // Create new file to store a piece of the csv file
   string PiecePath = OutputFolder + "\\" + Path.GetFileNameWithoutExtension(inputFile) + "_" + FileIndex + Path.GetExtension(inputFile);
   using (StreamWriter Writer = new StreamWriter(PiecePath, false))
   {
      Writer.AutoFlush = false;
      Writer.WriteLine(strHeader);

      // Read and writes precise number of rows
      int linesOut = 0;
      while( (linesOut < sizeOfEachFile) && ((s = reader.ReadLine()) != null) )
      {
            linesOut++;
            Writer.WriteLine(s);
      }
   }
   FileIndex++;
} while (s != null);


There might be the odd misplaced ( or ) - just done off the top of my head.
Have a look at your calculation for sizeOfEachFile - why two a decimal and a double? What do you get when you divide an int by an int and assign it to a decimal?

Regards
David R

GeneralRe: CSV File Splitter Help... Pin
Alistair Jarrett2-Apr-09 22:46
Alistair Jarrett2-Apr-09 22:46 
GeneralRe: CSV File Splitter Help... Pin
riced3-Apr-09 3:59
riced3-Apr-09 3:59 
QuestionAn easy one... problems converting a decimal to an integer Pin
bbranded2-Apr-09 5:31
bbranded2-Apr-09 5:31 
AnswerRe: An easy one... problems converting a decimal to an integer Pin
DaveyM692-Apr-09 5:37
professionalDaveyM692-Apr-09 5:37 
GeneralRe: An easy one... problems converting a decimal to an integer Pin
bbranded2-Apr-09 5:44
bbranded2-Apr-09 5:44 
GeneralRe: An easy one... problems converting a decimal to an integer Pin
DaveyM692-Apr-09 5:50
professionalDaveyM692-Apr-09 5:50 
AnswerRe: An easy one... problems converting a decimal to an integer Pin
harold aptroot2-Apr-09 6:08
harold aptroot2-Apr-09 6:08 
GeneralRe: An easy one... problems converting a decimal to an integer Pin
bbranded2-Apr-09 7:06
bbranded2-Apr-09 7:06 
GeneralRe: An easy one... problems converting a decimal to an integer Pin
harold aptroot2-Apr-09 8:19
harold aptroot2-Apr-09 8:19 
GeneralRe: An easy one... problems converting a decimal to an integer Pin
Luc Pattyn2-Apr-09 8:53
sitebuilderLuc Pattyn2-Apr-09 8:53 
GeneralRe: An easy one... problems converting a decimal to an integer Pin
harold aptroot2-Apr-09 9:11
harold aptroot2-Apr-09 9:11 
AnswerRe: An easy one... problems converting a decimal to an integer Pin
Luc Pattyn2-Apr-09 8:58
sitebuilderLuc Pattyn2-Apr-09 8:58 
Question1st Post and Code snip so far Pin
stonebergftw2-Apr-09 5:03
stonebergftw2-Apr-09 5:03 
AnswerRe: 1st Post and Code snip so far Pin
Judah Gabriel Himango2-Apr-09 5:45
sponsorJudah Gabriel Himango2-Apr-09 5:45 
GeneralRe: 1st Post and Code snip so far Pin
stonebergftw2-Apr-09 6:02
stonebergftw2-Apr-09 6:02 
GeneralRe: 1st Post and Code snip so far Pin
Judah Gabriel Himango2-Apr-09 6:04
sponsorJudah Gabriel Himango2-Apr-09 6:04 
AnswerRe: 1st Post and Code snip so far Pin
Simon P Stevens2-Apr-09 5:52
Simon P Stevens2-Apr-09 5:52 

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.