Private tbl As DataTable 'ここにデータを読み込んでおくこと Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim dstFile As String = "C:\temp\2.csv" Dim sjis As Encoding = Encoding.GetEncoding("Shift_JIS") 'ヘッダ行の書き込み File.WriteAllText(dstFile, _ String.Join(","c, tbl.Columns.Cast(Of DataColumn) _ .Select(Function(col) col.ColumnName)), sjis) 'データ行の書き込み File.AppendAllLines(dstFile, _ tbl.AsEnumerable().Select(Function(r) _ String.Join(","c, r.ItemArray)), sjis) End Sub