16,553
社区成员
发帖
与我相关
我的任务
分享
Dim S As String
S = line.Replace(" ", ",")
Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim sr As TextReader = New StreamReader("d:\myfile.txt")
Dim sw As StreamWriter = My.Computer.FileSystem.OpenTextFileWriter("d:\outfile.txt", True)
Dim mystr1 = "", mystr2 = "", mystr3 = "", line As String
Do
line = sr.ReadLine
'MsgBox(line)
If line Is Nothing Then
Exit Do
End If
mystr1 = line.Substring(0, 2)
mystr2 = line.Substring(2, 12)
mystr3 = line.Substring(14, 8)
'sw.WriteLine(line)
sw.WriteLine(mystr1 + "," + mystr2 + "," + mystr3)
Loop Until line Is Nothing
sr.Close()
sw.Close()
End Sub