Hi Guys,
What i'm trying to do here is save to file the items in a listview which meets the users criteria.
The problem is the streamwriter isn't saving any file, we get the saveDialog() popup but after hitting save nothing is saved, am i doing something wrong?
cheers for any help guys
Graham
What i'm trying to do here is save to file the items in a listview which meets the users criteria.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SaveFileDialog1.Title = "Select save location file..."
SaveFileDialog1.InitialDirectory = "C:"
SaveFileDialog1.Filter = "Text Files|*.txt"
SaveFileDialog1.FileName = "files.txt"
SaveFileDialog1.ShowDialog()
For Each itm As String In formMain.ListBoxMain.Items
Dim arraySplit As String() = itm.Split(">"c)
Dim fir As String = arraySplit(1)
Dim sec As String = arraySplit(1)
If (fir >= comboBoxcf.Text) And (sec >= comboBoxtf.Text) Then
Using SW As New StreamWriter("files.txt", True)
SW.WriteLine(itm)
End Using
End If
Next
End Sub
cheers for any help guys
Graham