I'm using this code to save/load listbox items:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim w As IO.StreamWriter
Dim r As IO.StreamReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
w = New IO.StreamWriter("c:\test.txt")
For i = 0 To ListBox1.Items.Count - 1
w.WriteLine(ListBox1.Items.Item(i))
Next
w.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
r = New IO.StreamReader("c:\test.txt")
While (r.Peek() > -1)
ListBox1.Items.Add(r.ReadLine)
End While
r.Close()
End Sub
End Class
from:
http://www.mpgh.net/forum/33-visual-...-contents.html
now i need to know how to remove the items without manually going into the text file and editing it. so i need a code for a button to remove the selected item.