This should be straight forward but i guess im doing something wrong
Imagine a series of records from a listbox
Each of these record is broken up into idividual substrings and each substring has to be written to a .csv file
So (assuming all substrngs have been generated by now)
Dim CustRec as New FileStream(SFD1.Filename, FileMode.Create, Fileaccess.Write)
Dim CWrite as New StreamWriter(CustRec)
CWrite.Writeline(cu01 & "," & cu02 & "," & cu03 & "," & VbCr
Cwrite.Close
Now i try and open the generated file in excell 2003 and it tells me the file format is unrecognizable. WHen i click OK, it opens the file, but places all records in the first column, as though it doesn't recognize the delimiter.
Different forms of encoding (Dim CWrite as New StreamWriter(CustRec, Encoding.XXX) don't seem to make any difference.
Can somebody please help me with what has to be something really simple
Cheers
Mc

CSV File Not opening properly in Excel
Jason L.
Ok
I'm gonna look silly but... i just tried a different source datastream and it worked.
Looks like there are two strange records at the beginning of teh first data stream i was testing it with.
I'll have to do some further research.
Heta Thakkar
It seems to me that you might be adding everything together as a single string and that is the reason why it is in a single column.
I remember in VB6 that all you had to do was add a comma as a separator and not add it as a string. So try doing this statement and see if it works:
CWrite.Writeline(cu01, cu02, cu03)
When you want to write a new line then simply use a new CWrite.Writeline statement
Prambo
Hmm
That didn't work. It only writes the first field, and nothing else.
:(
martijnv
Check this out:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfSystemIOStreamWriterClassTopic.asp
It might have something about what you need to do.