Hello,
I have been trying to save a object to a file then read the object back into
another program. I have a map maker program and a map reader program and
for some reason after I save the map data to file in the maker it will not read
it in the map reader program. I can read and load the file fine in the
mapmaker program but i get this error that seems to indicate that it is looking
for the original program that made the file as part of the deserializing of the
object from the file. Mapmaker is the original program that produced the data
file.
formatters and basically get the same error. All this should do is load the file
back into a Map Object.
Nothing much just testing some ideas on saving and loading image files.
All the class is is an x and y coordinates for start location and a 2 dimensional
array to hold the Image files to be sent to the drawing routine.
Is reading a serialized object from a file into a seperate program even
possible in vb.net? And if so what steps am I missing Any help would be appreciated.
Zarz
p.s.
sorry for duplicate post meant to post it here first time
I have been trying to save a object to a file then read the object back into
another program. I have a map maker program and a map reader program and
for some reason after I save the map data to file in the maker it will not read
it in the map reader program. I can read and load the file fine in the
mapmaker program but i get this error that seems to indicate that it is looking
for the original program that made the file as part of the deserializing of the
object from the file. Mapmaker is the original program that produced the data
file.
Here is the code segment I have been using I have tried both soap and binaryAn unhandled exception of type 'System.Runtime.Serialization.SerializationExcepti on' occurred in system.runtime.serialization.formatters.soap.dll
Additional information: Parse Error, no assembly associated with Xml key a1:http://schemas.microsoft.com/clr/nsa...r/Mapmaker,%
20Version%3D1.0.3022.24556%2C%20Culture%3Dneutral% 2C%20PublicKeyToken%3Dnull Map
formatters and basically get the same error. All this should do is load the file
back into a Map Object.
VB.NET:
Dim fs As FileStream
Dim mapin As Map
Dim bf As SoapFormatter = New SoapFormatter
Dim result As DialogResult
Open.InitialDirectory = Application.StartupPath
result = Open.ShowDialog
If result <> DialogResult.Cancel Then
fs = New FileStream(Open.FileName, FileMode.Open)
mapin = CType(bf.Deserialize(fs), Map)
fs.Close()
End If
Here is the Map object I am trying to serialize and read into a seperate
program.
<Serializable()> Public Class Map
Private StartX As Integer
Private StartY As Integer
Private Textures(,) As Image
Public Sub New(ByVal tex(,) As Image)
StartX = 0
StartY = 0
Textures = tex
End Sub
Public Sub New(ByVal x As Integer, ByVal y As Integer, ByVal tex(,) As Image)
StartX = x
StartY = y
Textures = tex
End Sub
End Class
All the class is is an x and y coordinates for start location and a 2 dimensional
array to hold the Image files to be sent to the drawing routine.
Is reading a serialized object from a file into a seperate program even
possible in vb.net? And if so what steps am I missing Any help would be appreciated.
Zarz
p.s.
sorry for duplicate post meant to post it here first time