Hello everyone, Im a beginner in vb.net and currently Im developing a program where i save date to a txt file like this Reminder#dinner#26-07-2012 19:52:00 and show it in a listbox(all the lines in the txt file).
What i want to do is to select a line(item) in the listbox and delete it in the txt file.
How can i delete a line of a txt file by selecting it from the listbox? I already can check if the line(i) its equal to the selected item of the textbox
Heres the code that i have:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click, task_viewer.Click Dim lines() As String = IO.File.ReadAllLines("C:\Users\Guilherme\Documents\database\data_base_tasks.txt") For i As Integer = 0 To UBound(lines) If lines(i) = task_viewer.SelectedItem.ToString Then MsgBox(lines(i)) ' this was to see if the selected item in the listbox would show the line that was on the txt file, and it shows End If Next End Sub