I have a project to complete and i have begun the code. What i want to do is go through the text file and find evey | (pipe) symbol and change it to a , (comma). I have the code and worked out how to do it but the code will only work for the first line. I was just wondering whether any of you had any advice on the way through this problem because i am stumped.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_ System.EventArgs) Handles Button1.Click Dim strFile As String Dim strDocument As String strFile = "C:\Documents and Settings\Orbops\Desktop\Ben's stuff\1.txt" FileOpen(1, strFile, OpenMode.Input, OpenAccess.Read, OpenShare.LockWrite) FileSystem.Input(1, strDocument) FileClose(1) strDocument = Replace(strDocument, "|", ",", , , CompareMethod.Text) 'Opens our document for output, with write only access, and locks the 'writability until we're done FileOpen(1, strFile, OpenMode.Output, OpenAccess.Write, OpenShare.LockWrite) 'Writes the strDocument text to the file FileSystem.Write(1, strDocument) 'Closes the handle to the file, allowing all programs to edit the file FileClose(1) End Sub
Thanks in advance....!