Results 1 to 2 of 2

Thread: Writing to New XML File Throws IOException

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    1

    Writing to New XML File Throws IOException

    VB Code:
    1. Try
    2.             Dim loXmlWriter As New Xml.XmlTextWriter("\\My Documents\\mcsd.fclib", System.Text.Encoding.UTF8)
    3.  
    4.             loXmlWriter.WriteStartDocument()
    5.             loXmlWriter.WriteStartElement("testlib")
    6.  
    7.             loXmlWriter.WriteStartElement("info")
    8.             loXmlWriter.WriteAttributeString("name", "MCSD 70-306")
    9.             loXmlWriter.WriteEndElement()
    10.  
    11.             loXmlWriter.WriteStartElement("questioncollection")
    12.             loXmlWriter.WriteStartElement("question")
    13.             loXmlWriter.WriteAttributeString("qtext", "What is the latest version of windows")
    14.             loXmlWriter.WriteAttributeString("atext", "Windows XP")
    15.             loXmlWriter.WriteEndElement()
    16.             loXmlWriter.WriteEndElement()
    17.  
    18.             loXmlWriter.WriteEndElement()
    19.             loXmlWriter.WriteEndDocument()
    20.             loXmlWriter.Close()
    21.         Catch ex As Exception
    22.             MsgBox(ex.Message)
    23.         End Try

    Hello all.

    The above code throws an exception in the .NET framework when on the first line where it tries to write the file. What am i doing wrong, it can't be to compilcated but i can't for the life of me work it out.

    Can someone help?

    Also, if there is a better way to do this, please post

    Thanks

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: Writing to New XML File Throws IOException

    only need for one slash '/'

    Dim loXmlWriter As New Xml.XmlTextWriter("\My Documents\mcsd.fclib", System.Text.Encoding.UTF8)
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width