我正在开发一个销售应用程序,我添加了一个列表视图和文本框,以便将内容添加到列表中。列表视图包含3列: 产品价格支付类型。
下面的代码是保存列的代码,但我需要添加一些东西
Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveToolStripMenuItem.Click
Dim sfile As New SaveFileDialog
With sfile
.Title = "Choose your path to save the information"
.InitialDirectory = ":\"
.Filter = ("ONLY Text Files (*.txt) | *.txt")
End With
If sfile.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim Write As New IO.StreamWriter(sfile.FileName)
Dim k As ListView.ColumnHeaderCollection = ListView1.Columns
For Each x As ListViewItem In ListView1.Items
Dim StrLn As String = ""
For i = 0 To x.SubItems.Count - 1
StrLn += k(i).Text + " :" + x.SubItems(i).Text + Space(30)
Next
Write.WriteLine(StrLn)
Next
Write.Close() 'Or Write.Flush()
MsgBox("File Saved !")
End If
End Sub
我想添加,当我保存列时,要添加到保存的.txt文件的price列的SUM。帮忙?
1更多的事情,在列表视图下方,我需要一个标签来显示价格列的总和。每次添加产品时它都会发生变化。在此先感谢!