I am going to do a project at school using sequential file to rewrite the file instead of overwrite.

What my code do is trying to wipe out my record and replace with one new variable, and how can i edit which record i like?Example like if i have three record variable,
"cats", "dogs" and "human" in my file.
How can i choose "dogs" to rename as "dogy" instead of wipe out all the data and replace just the new variable dogy?


my code reference:

in module
public names as string*50
public path as string


Private Sub cmdEditName_Click()
Dim edit As CateData
Dim filename As String
Close

path = "a:\budget2\"
filename = "cats.lst"

Open filename For Output As #1


edit.CateName = InputBox("What is the new name of the catergory", "Rename Catergory", lstExisting.List(lstExisting.ListIndex))
If Len(edit) <> 0 Then
Write #1, edit.CateName
'using listbox to show the file data
lstExisting.List(lstExisting.ListIndex) = edit.CateName

End If
cmdEditName.Enabled = False

End Sub