In a previous post on this subject _Hawk_ gave me some code that with only minor tweaks has me nearly there. What I'm getting now looks exactly like the above format in Notepad, but I can't import it into my fax machine address book app. If I open the .csv in Excel, or paste the text into Word the format looks like this:
The first line is correct, but each succeeding line is like the above. It looks like a new line is being inserted where it doesn't belong, but I can't figure out why.
This is what I have now:
Imports System Imports System.IO Imports System.Text Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Using sw As New StreamWriter("c:\test.csv") 'get each line Dim prefix As String = "x," & "x" & ",,,," Dim suffix As String = ",,,," & "G3" & ",,," & "0" & ",,,,," & "0" For Each line As String In TextBox1.Text.Split(Environment.NewLine) 'replace the spaces with commas Dim swLine As String = line sw.WriteLine(prefix & swLine & suffix) Next End Using 'close the stream End Sub End Class
I thought this was going to be a simple enough project that even my very limited programming knowledge would be enough, but this has been beating me up pretty good. Any suggestions will be greatly appreciated. Thanks.