我有以下代码,想要做两件事。我想将两个W.writeLine代码分开一行或两行。 VbCrlf似乎不起作用我得到错误。我还想将Total Due和TotalDueTextBox.Text的颜色更改为红色。有什么建议吗?
Private Sub SaveAsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveAsToolStripMenuItem.Click
sFile.InitialDirectory = ("C:\")
sFile.FileName = ("Save As...")
sFile.Filter = ("Only Text Files (*.txt)|*.txt")
sFile.ShowDialog()
Dim W As New IO.StreamWriter(sFile.FileName, True) ' notes from class need messgbox
Dim i As Integer
For i = 0 To PurchaseListBox.Items.Count - 1
W.WriteLine(PurchaseListBox.Items.Item(i))
Next
Dim TotalDue As String = TotalDueTextBox.Text
W.WriteLine(vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "TotalDue" & TotalDueTextBox.Text.PadLeft(14, ""))
W.Close()
End Sub
答案 0 :(得分:0)
每次要打印空白行时,您都可以致电WriteLine("")
。