コーディングミス?

brタグ打つのが面倒くさいので、sharp developperを落としてきて、テキストの文末にbrコードを入れるツールを書いた。
テストすると動くのに、リリースすると化ける。
デバック用だけきちんと稼動する。謎だ。
書いた時間がもったいないので、デバッグ用で使おう。この程度なら速度変わらないし…


Private button3 As System.Windows.Forms.Button
Private textBox1 As System.Windows.Forms.TextBox
Private button2 As System.Windows.Forms.Button
Private button1 As System.Windows.Forms.Button

Sub Button1Click(sender As Object, e As System.EventArgs)
Dim OFD As New OpenFileDialog
OFD.InitialDirectory = My.Application.Info.DirectoryPath
OFD.ShowDialog()
TextBox1.Text = OFD.FileName
End Sub

Sub Button2Click(sender As Object, e As System.EventArgs)
Dim FN As String
Dim buf As String = ""
If FileIO.FileSystem.FileExists(TextBox1.Text)=False Then
MsgBox("ファイルがありません")
Exit Sub
End If
FN = FileIO.FileSystem.GetName(TextBox1.Text)
FileIO.FileSystem.CopyFile(TextBox1.Text,"C:\Temp\" & FN,True)
Dim IO1 As New System.IO.StreamReader(TextBox1.Text,System.Text.Encoding.GetEncoding("Shift-JIS"))
Dim IO2 As New System.IO.StreamWriter("C:\Temp\" & FN)
Do Until IO1.EndOfStream
buf = IO1.ReadLine()
buf = buf & "<br>"
IO2.WriteLine(buf)
Loop
IO1.Close
IO2.Close
FileIO.FileSystem.CopyFile("C:\Temp\" & FN,TextBox1.Text,True)
FileIO.FileSystem.DeleteFile("C:\Temp\" & FN)
MsgBox("変換終了")
End Sub

Sub Button3Click(sender As Object, e As System.EventArgs)
Me.Close
End Sub
End Class