im making a program for school (in VB.NET) where i have a listview. When the user enters a customer name and presses "OK"it is outputted in the listview as a "o"
the code for the program is:
Public Class Form1
Dim w As IO.StreamWriter
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    lstOutput.Items.Clear()
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
    End
End Sub
Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click
    Dim sfile As New SaveFileDialog
    With sfile
        .Title = "Choose your path to save the information"
        .InitialDirectory = "C:\"
        .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 = lstOutput.Columns
        For Each x As ListViewItem In lstOutput.Items
            Dim StrLn As String = ""
            For i = 0 To x.SubItems.Count - 1
                StrLn += k(i).Text + " :" + x.SubItems(i).Text + Space(3)
            Next
            Write.WriteLine(StrLn)
        Next
        Write.Close() 'Or  Write.Flush()
    End If
End Sub
Private Sub txtDiscPrice_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub btnAdd_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
    Dim secondform As New Form2
    secondform.ShowDialog()
    Dim item As ListViewItem
    item = lstOutput.Items.Add(secondform.CustomerName)
    item.SubItems.Add(secondform.Item)
    item.SubItems.Add(secondform.ItemPrice)
    item.SubItems.Add(secondform.Quantity)
    item.SubItems.Add(secondform.TotalPrice)
    item.SubItems.Add(secondform.DiscPerc)
    item.SubItems.Add(secondform.DiscPrice)
    item.SubItems.Add(secondform.PaymentMethod)
End Sub
End Class
and for the second form, where the user enters the information the code is:
Public Class Form2
Public CustomerName As String
Public Item As String
Public ItemPrice As Double
Public Quantity As Integer
Public TotalPrice As Integer
Public DiscPerc As Double
Public DiscPrice As Double
Public PaymentMethod As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    CustomerName = Val(txtCustName.Text)
    Item = Val(txtItemName.Text)
    ItemPrice = Val(txtItemPrice.Text)
    Quantity = Val(txtQuantity.Text)
    TotalPrice = Val(txtTtlPrice.Text)
    DiscPerc = Val(txtDiscPerc.Text)
    DiscPrice = Val(txtDiscPrice.Text)
    PaymentMethod = Val(txtPaymentMethod.Text)
    Me.Close()
End Sub
End Class
I've been stuck on this for ages, any help is appreciated!
 
    