Rev. Jim / Minimalist, I'm attempting to convert the code to VB.net. I've got it to write something but it's writing only one line. I'm sure I need to use "Using" or some kind of loop for it to read and write each line. Here's what I've got so far:

            My.Computer.FileSystem.ReadAllText(RestranName)
            ' This begins to add the carriage returns in the appropriate places
            txtLine = Replace(Text, vbLf, vbCrLf)
            txtLine = Replace(Text, vbCr & vbCr, vbCr)
            txtLine = Replace(Text, """", "")

            ' This writes the line to the file
            My.Computer.FileSystem.WriteAllText(fileSave, txtLine, False)

I got an error message when I tried "Using". The line looked like this:

Using My.Computer.FileSystem.ReadAllText(RestranName)

The message said "Using operand of type "String" must implement "System.IDisposal". I'm not sure what it's trying to tell me.

Thought and ideas?

Thanks again.

Don

You don't need Using.

Dim text As String = My.Computer.FileSystem.ReadAllText(RestranName)

will read the entire file into one string variable.

Group,

I finally figured it out. Here's the final code:

        RestranName = "C:\Restran Conversion\IPSDATA\PM00213A\20141210.142601"
        Dim fileSave As String = "C:\Restran Conversion\IPSDATA\PM00213A\213RT20141210.txt"

        ' This reads the text file for conversion
        txtLine = My.Computer.FileSystem.ReadAllText(RestranName)
        ' This begins to add the carriage returns in the appropriate places
        txtLine = Replace(txtLine, vbLf, vbCrLf)
        txtLine = Replace(txtLine, vbCr & vbCr, vbCr)
        txtLine = Replace(txtLine, """", "")

        ' This writes the line to the file
        My.Computer.FileSystem.WriteAllText(fileSave, txtLine, False)

Again, thank you everyone for your help.

Don

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.