title: Function to return info
body: <p>I changed the above to use string builder but some reason its not comming through on the loop its returning ok through the <code>OrdersLine</code> variable but not to the <code>stream</code> . Below is the loop im declaring it in </p>
  
  <pre><code>    Dim OrdersLine As String
  
  
      For Each item As String In split
  
  
  
          For Each thisEntry As DataRow In orderHeaderInformation.Rows
              orderLineInformation = connection.SqlSelectToDataTable(scriptBuilder.GetOrderLineInformation(item, thisEntry.Item("location")))
              Dim orderNumber = From row In newEntries.AsEnumerable()
              Select row.Field(Of String)("ordernumber") Distinct
              For Each c In IO.Path.GetInvalidFileNameChars
                  filename = thisEntry.Item("orderNumber").ToString().Replace(c, "")
              Next
              ediExportPath = configuration.EditExport
  
              filename = ediExportPath &amp; "\" &amp; filename &amp; "_" &amp; thisEntry.Item("location") &amp; ".edi"
              Dim streamWriter As New IO.StreamWriter(filename)
              OrdersLine = ExportOrdersLine(orderLineInformation).ToString()
              streamWriter.WriteLine(OrdersLine)
  
  
              streamWriter.Close()
              streamWriter.Dispose()
  
          Next
  
      Next
  
  
  Public Function ExportOrdersLine(editProductLine As DataTable) As String
      Dim retVal As String
  
      Dim newRecord As infoEDILine
      Dim filenameWithoutExtensions As String
  
      Dim i As Integer = 1
  
      Dim edilIneOrder As New StringBuilder
  
      For Each thisentry In editProductLine.Rows
          edilIneOrder.AppendLine("LIN+" &amp; i &amp; thisentry.Item("TagBcode") &amp; ":EN'")
          edilIneOrder.AppendLine("PIA+1" &amp; thisentry.Item("PLU") &amp; ":SA'")
          edilIneOrder.AppendLine("IMD+C++CU'")
          edilIneOrder.AppendLine("IMD+F++:::" &amp; thisentry.Item("Style.Description") &amp; "'")
          edilIneOrder.AppendLine("QTY+" &amp; thisentry.Item("PLU") &amp; ":1'")
          edilIneOrder.AppendLine("QTY+" &amp; thisentry.Item("OnOrder") &amp; ":1'")
          edilIneOrder.AppendLine("TAX+7+VAT+++:::00" &amp; thisentry.item("VatRate") &amp; "'")
          ' if the vat rate is zero add three zeros to above line
          ' if the vat rate is not zero add only two 00 lke above line
          ' if no decimal places add one decimal place of zero
  
          edilIneOrder.AppendLine("MOA+203:" &amp; thisentry.item("LineNetCost") &amp; "'")
          edilIneOrder.AppendLine("PRI++AAA:" &amp; thisentry.Item("GrossCost") &amp; "'")
          edilIneOrder.AppendLine("PRI++AAB:" &amp; thisentry.Item("WholeSaleCost") &amp; "'")
          edilIneOrder.AppendLine("UNS+S'")
  
          i = i + 1
  
      Next
  
  
      Return edilIneOrder.ToString()
  
  End Function
  </code></pre>