Below is my code, I'm opening an xml file and I have a chat name node
within it. By default the node has a value of "mypc" for which I'm
replacing and putting in a new value. I don't know if this is the best
approach but I'm trying it. I can open the stream fine and replace the
text. But when I try to write the stream back, I get an error saying
the file is in use by another process. Any ideas? Thanks in advance
myStreamReader = File.OpenText("../Config.xml")
strConfigFile = myStreamReader.ReadToEnd()
myStreamReader.Close()
'-- Get the computer name from the XML
strXMLComputerName = Mid(strConfigFile, InStr(strConfigFile,
"<chat_name>") + 11, InStr(strConfigFile, "</chat_name") -
(InStr(strConfigFile, "<chat_name>") + 11))
'-- Replace the default chat name with the pc name
strConfigFile = Replace(strConfigFile, strXMLComputerName,
strComputerName)
myStreamWriter = File.CreateText("../Config.xml")
myStreamWriter.Write(strConfigFile)
myStreamWriter.Close()