S
Sid Price
I have an application with the following code:
Try
oFile = New FileStream(strConfigFile, FileMode.Create, FileAccess.Write,
FileShare.None)
'
' File is opened, write to it using XMLDocument
'
Dim oXMLFile As New Xml.XmlDocument()
'
' Set doc type
'
Dim xmlDeclaration As Xml.XmlDeclaration =
oXMLFile.CreateXmlDeclaration("1.0", "utf-8", "")
'
' Create the root element
'
Dim RootNode As Xml.XmlNode = oXMLFile.CreateElement("VMSchedule")
oXMLFile.InsertBefore(xmlDeclaration, oXMLFile.DocumentElement)
oXMLFile.AppendChild(RootNode)
'
' write out the data here ...
'
oXMLFile.Save(oFile)
oFile.Close()
Catch ex As Exception
System.Threading.Thread.Sleep(cFileAccessTimeout)
iRetry -= 1
End Try
The file is open with another application in order to test the exception
handling, however when I step through the code with the debugger an
"unhandled exception" message pops up when I execute the file open line. Can
anyone see why it thinks the exception is unhandled, I am trying to catch
it?
Thanks,
Sid.
Try
oFile = New FileStream(strConfigFile, FileMode.Create, FileAccess.Write,
FileShare.None)
'
' File is opened, write to it using XMLDocument
'
Dim oXMLFile As New Xml.XmlDocument()
'
' Set doc type
'
Dim xmlDeclaration As Xml.XmlDeclaration =
oXMLFile.CreateXmlDeclaration("1.0", "utf-8", "")
'
' Create the root element
'
Dim RootNode As Xml.XmlNode = oXMLFile.CreateElement("VMSchedule")
oXMLFile.InsertBefore(xmlDeclaration, oXMLFile.DocumentElement)
oXMLFile.AppendChild(RootNode)
'
' write out the data here ...
'
oXMLFile.Save(oFile)
oFile.Close()
Catch ex As Exception
System.Threading.Thread.Sleep(cFileAccessTimeout)
iRetry -= 1
End Try
The file is open with another application in order to test the exception
handling, however when I step through the code with the debugger an
"unhandled exception" message pops up when I execute the file open line. Can
anyone see why it thinks the exception is unhandled, I am trying to catch
it?
Thanks,
Sid.