0
我有以下代碼並想要做兩件事。我想將兩個W.writeLine代碼分開一兩行。 VbCrlf似乎沒有工作我收到錯誤。我還想將Total Due和TotalDueTextBox.Text的顏色更改爲紅色。有什麼建議麼?如何格式化一個行Break(VBCrLf)
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
你會得到什麼錯誤?應該沒有理由不使用'VbCrLf'。你總是可以使用它的框架相當於'Environment.NewLine' – codemonkeh