VB.net每行添加指定字符串的方法
VB.net A method to add a speciefied String to every line
我正在编写一个程序,该程序具有包含许多文本字段和组合框的掩码。到现在为止一切正常,但我想让它变得更容易,并在行尾添加一个词,以帮助我稍后识别每一行的输出。这就是 streamWriter 代码
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*"
Save.CheckPathExists = True
Save.Title = "Save File"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.WriteLine(TextBox1.Text)
myStreamWriter.WriteLine(TextBox4.Text)
myStreamWriter.WriteLine(ComboBox6.Text)
myStreamWriter.WriteLine(ComboBox5.Text)
myStreamWriter.WriteLine(TextBox3.Text)
myStreamWriter.WriteLine(TextBox5.Text)
myStreamWriter.WriteLine(TextBox6.Text)
myStreamWriter.WriteLine(TextBox7.Text)
myStreamWriter.WriteLine(TextBox8.Text)
myStreamWriter.WriteLine(TextBox9.Text)
myStreamWriter.WriteLine(TextBox11.Text)
myStreamWriter.WriteLine(TextBox10.Text)
myStreamWriter.WriteLine(TextBox12.Text)
myStreamWriter.WriteLine(TextBox2.Text)
myStreamWriter.WriteLine(TextBox13.Text)
myStreamWriter.WriteLine(TextBox14.Text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
End Sub
这就是我得到的输出 txt 文件:
我知道你们可以帮助我。
myStreamWriter.WriteLine(TextBox13.Text & " " & "This is the Serial Number")
我正在编写一个程序,该程序具有包含许多文本字段和组合框的掩码。到现在为止一切正常,但我想让它变得更容易,并在行尾添加一个词,以帮助我稍后识别每一行的输出。这就是 streamWriter 代码
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*"
Save.CheckPathExists = True
Save.Title = "Save File"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.WriteLine(TextBox1.Text)
myStreamWriter.WriteLine(TextBox4.Text)
myStreamWriter.WriteLine(ComboBox6.Text)
myStreamWriter.WriteLine(ComboBox5.Text)
myStreamWriter.WriteLine(TextBox3.Text)
myStreamWriter.WriteLine(TextBox5.Text)
myStreamWriter.WriteLine(TextBox6.Text)
myStreamWriter.WriteLine(TextBox7.Text)
myStreamWriter.WriteLine(TextBox8.Text)
myStreamWriter.WriteLine(TextBox9.Text)
myStreamWriter.WriteLine(TextBox11.Text)
myStreamWriter.WriteLine(TextBox10.Text)
myStreamWriter.WriteLine(TextBox12.Text)
myStreamWriter.WriteLine(TextBox2.Text)
myStreamWriter.WriteLine(TextBox13.Text)
myStreamWriter.WriteLine(TextBox14.Text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
End Sub
这就是我得到的输出 txt 文件:
我知道你们可以帮助我。
myStreamWriter.WriteLine(TextBox13.Text & " " & "This is the Serial Number")