0

Hi, I have been given the task of basically reading and writing to and from files. Below is the code from one sub:

      If btnSaveRecipe.Enabled = True Then
            FileName = "C:\Users\Leyla\Documents\Recipe Task\Recipe.txt"
            FileWriter = New IO.StreamWriter(FileName)
            For index = 0 To lstRecipe.Items.Count - 1 'For the number of ingredients in the listbox
                StrEntry = lstRecipe.Items(index)
                FileWriter.Write(StrEntry)
                FileWriter.Write(vbNewLine) 'Start a new line
            Next

I can't work out what i've done wrong, but when I open the file itself in the folder, it is empty. Please help :)

2
Contributors
1
Reply
4
Views
5 Years
Discussion Span
Last Post by Branickiod
0
public sub ListFiles()
'DIR for folder
'add each file to ListBox control
For each file as string in IO.directory.getfiles(Folder Path)
Listbox.items.Add(file)
next
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.