okay so my problem is that i am reading information from XML's,
and i also have a delete button for some that i want to remove after getting the proper information.
tho i am having an error deleting the file after i got the information from inside, saying 'it is being used by another process':
there is no chance another app is accessing that same file, it must be a problem within my code!
System.IO.IOException: 'The process cannot access the file 'FilePath.xml' because it is being used by another process.'
here is the code i am using the read information from XML, while avoiding encoding problems and 'case sensitive' tags.
i have tried putting
Stream.Close
and also
textReader.Close
but that did not solve my problem.
trying to delete/;
and i also have a delete button for some that i want to remove after getting the proper information.
tho i am having an error deleting the file after i got the information from inside, saying 'it is being used by another process':
there is no chance another app is accessing that same file, it must be a problem within my code!
Quote:
System.IO.IOException: 'The process cannot access the file 'FilePath.xml' because it is being used by another process.'
here is the code i am using the read information from XML, while avoiding encoding problems and 'case sensitive' tags.
i have tried putting
Stream.Close
and also
textReader.Close
but that did not solve my problem.
Code:
Public Function RipXML(ByRef x As String, y As String)
Dim Stream As New IO.StreamReader(x, System.Text.Encoding.UTF8)
Dim textReader As New Xml.XmlTextReader(Stream)
Dim lastElementName As String = ""
While textReader.Read()
Select Case textReader.NodeType
Case Xml.XmlNodeType.Element
lastElementName = textReader.Name
Case Xml.XmlNodeType.Text
If lastElementName.ToLower = y.ToLower Then
y = textReader.Value.Trim
Return y
End If
End Select
End While
End Function
Code:
My.Computer.FileSystem.DeleteFile(FilePath)