Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FileName As String = "c:\test.csv"
Dim lines() As String = System.IO.File.ReadAllLines(FileName)
Dim values As New List(Of String)
For i As Integer = 0 To lines.GetUpperBound(0)
values.Clear()
values.AddRange(lines(i).Split(","))
' remove all unwanted columns in backwards order
' so you don't have to adjust the column numbers as you go
values.RemoveAt(99) ' Remove 100th column
values.RemoveAt(87) ' Remove 88th column
values.RemoveAt(84) ' Remove 85th column
lines(i) = String.Join(",", values.ToArray)
Next
System.IO.File.WriteAllLines(FileName, lines)
End Sub
|