csv file help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stranger3

    csv file help

    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(pt h, False)

    Dim delim As String
    'write out the header row
    delim = ""
    Dim text As String = ""
    For Each col As DataColumn In dsvendorontime. Tables(2).Colum ns
    output.Write(de lim)
    output.Write(co l.ColumnName)
    delim = ","
    text = text + delim + col.ColumnName
    Next
    output.WriteLin e(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(de lim)
    If TypeOf value Is String Then
    output.Write("" ""c)
    ' output.Write(va lue)
    'output.Write(" """c)
    Else
    output.Write(va lue)
    End If
    delim = ","
    Next
    output.WriteLin e()
    Next
    output.Close()

  • Spam Catcher

    #2
    Re: csv file help

    "Stranger3" <u28800@uwewrot e in news:68f2ccb6bf 0a3@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.

    Comment

    Working...