?
Solved

Reading xml file from another project

Posted on 2005-05-01
3
Medium Priority
?
171 Views
Last Modified: 2010-04-23
Experts,

I am using following code to write an xml file.

    <Serializable()> Public Class mysettings
        Public TestAs String

        Public Sub SaveXml(ByVal Path As String)
            Dim fStream As System.IO.FileStream
            Dim myFormat As New System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            Try
                fStream = New System.IO.FileStream(Path, IO.FileMode.Create, IO.FileAccess.Write)
                myFormat.Serialize(fStream, Me)
                fStream.Close()
            Catch ex As Exception
                MsgBox("Error saving: " & ex.Message, , "Message")
            Finally
                If Not (fStream Is Nothing) Then fStream.Close()
            End Try
        End Sub

        Public Shared Function LoadXML(ByVal Path As String) As mysettings
            Dim fStream As System.IO.FileStream
            Dim myFormat As New System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            Dim tmp As mysettings
            Try
                fStream = New System.IO.FileStream(Path, IO.FileMode.Open, _
                    IO.FileAccess.Read)
                tmp = CType(myFormat.Deserialize(fStream), mysettings)
            Catch ex As Exception
                MsgBox("Error opening: " & ex.Message, , "Message")
            Finally
                If Not (fStream Is Nothing) Then fStream.Close()
            End Try
            Return tmp

        End Function
    End Class

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As New mysettings

        x.test = txtTest.Text
        x.SaveXml(Path & "Test.xml")
End Sub

Then I use following code to read the xml file from another project.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As New mysettings
        x = x.LoadXML(Path & "Test.xml")
        txtTest.text = x.test
End Sub


When reading the xml file, I got error message: “Error Open: Parse Error, no assemble associated with Xml key…

I need read the xml file from another project. How can I do that? Any help will be much appreciated.


0
Comment
Question by:xiaominghng
1 Comment
 
LVL 9

Accepted Solution

by:
checoo earned 2000 total points
ID: 13907003
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question