Question

I have this code:

Dim WriterDay1 As New System.IO.StreamWriter("C:\Users\IOSEagle\Desktop\My Projects\Microsoft Visual Basic 2010\Form\Programes\MyAlarm\MyAlarm\RepeatDays\Monday.txt")
WriterDay1.Write(MondayCheckBox.Text)
WriterDay1.Close()

How can I delete this text file From this path?

Was it helpful?

Solution

You could do something like this to get the path:

Dim fullPath as String = ((FileStream)(WriterDay1.BaseStream)).Name

And then delete the file after it is closed with this:

File.Delete(fullPath)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top