In my program (in VB 2010), the user types a file name into the "input" text box, types a file name into the "output" text box, and clicks a button. When the button routine takes place, the program opens/reads from the specified input file and transfers the information to the output file. I have the program working correctly and transferring the data from the input to the output file, however I'm having some trouble formatting the information.
The information the program will read from the input file will be formatted (not necessarily same words, numbers, etc.) as follows:
Doe, John, 5 Main St., Greensburg, PA, 15601
When writing this information to the output file, it should be formatted as follows:
John Doe
5 Main St.
Greensburg, PA 15601
My code for the button routine as of right now includes an array and a loop to read until the end of the file. Can anyone help me write code to format the data from the input file as above?
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
Dim strLine As String
Dim strInfo(1) As String
Do Until fvInput.Peek = -1
strLine = fvInput.ReadLine()
strInfo = strLine.Split(",")
Loop
For N = 0 To strInfo.Length - 1
fvOutput.Write(strInfo(N))
Next
fvInput.Close()
fvOutput.Close()
End Sub
Thanks in advance!
The information the program will read from the input file will be formatted (not necessarily same words, numbers, etc.) as follows:
Doe, John, 5 Main St., Greensburg, PA, 15601
When writing this information to the output file, it should be formatted as follows:
John Doe
5 Main St.
Greensburg, PA 15601
My code for the button routine as of right now includes an array and a loop to read until the end of the file. Can anyone help me write code to format the data from the input file as above?
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
Dim strLine As String
Dim strInfo(1) As String
Do Until fvInput.Peek = -1
strLine = fvInput.ReadLine()
strInfo = strLine.Split(",")
Loop
For N = 0 To strInfo.Length - 1
fvOutput.Write(strInfo(N))
Next
fvInput.Close()
fvOutput.Close()
End Sub
Thanks in advance!