Public Shared Sub WriteDataToFile(ByVal submittedDataTable As DataTable, ByVal submittedFilePath As String)
Dim i As Integer = 0
Dim sw As StreamWriter = Nothing
sw = New StreamWriter(submittedFilePath, False)
For i = 0 To submittedDataTable.Columns.Count - 1- 1 Step i + 1
sw.Write(submittedDataTable.Columns(i).ColumnName + ";")
Next
sw.Write(submittedDataTable.Columns(i).ColumnName)
sw.WriteLine()
Dim row As DataRow
For Each row In submittedDataTable.Rows
Dim array() As Object = row.ItemArray
For i = 0 To array.Length - 1- 1 Step i + 1
sw.Write(array(i).ToString() + ";")
Next
sw.Write(array(i).ToString())
sw.WriteLine()
Next
sw.Close()
End Sub
WriteDataToFile(dt,"/path/thaicreate.txt")