By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 958 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

csv file help

P: n/a
I am trying to create a comma delimited file from visual basic .net and then
open it from excel for further processing.
The problem I am running into so far is that after the file is created,
nothing is written to it.
Please help me and thank you in advance.
My code is shown below:

Dim output As New StreamWriter(pth, False)

Dim delim As String
'write out the header row
delim = ""
Dim text As String = ""
For Each col As DataColumn In dsvendorontime.Tables(2).Columns
output.Write(delim)
output.Write(col.ColumnName)
delim = ","
text = text + delim + col.ColumnName
Next
output.WriteLine(text)
'write out each data row
For Each row As DataRow In dsvendorontime.Tables(2).Rows
delim = ""
For Each value As Object In row.ItemArray
output.Write(delim)
If TypeOf value Is String Then
output.Write(""""c)
' output.Write(value)
'output.Write(""""c)
Else
output.Write(value)
End If
delim = ","
Next
output.WriteLine()
Next
output.Close()

Nov 7 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Stranger3" <u28800@uwewrote in news:68f2ccb6bf0a3@uwe:
I am trying to create a comma delimited file from visual basic .net
and then open it from excel for further processing.
The problem I am running into so far is that after the file is
created, nothing is written to it.
Take a look at FileHelpers on SourceForge.
Nov 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.