serialize


G

Gillard

i get an exeption and i do not know what else to do to continue
Dim sdf As New SaveFileDialog
With sdf
.AddExtension = True
.DefaultExt = ".record"
.FileName = Now.ToLongDateString
.Filter = "recorder (*.record)|*.record"
End With
If sdf.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim Serializer As New
Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim DataFile As New FileStream(sdf.FileName,
FileMode.Create, FileAccess.Write, FileShare.None)

Serializer.Serialize(DataFile, eventsi)
DataFile.Close()
' Data = Nothing
End If

exeption message :


type 'System.Windows.Forms.MouseEventArgs' in assembly
'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' not serializable
 
Ad

Advertisements

G

Gillard

yes i'm trying to serialize mouse event
Private eventsi As List(Of MacroEvent) = New List(Of MacroEvent)()

I need to do this for a mouse and keyboard recorder
i 'm trying to do a smal utility like it was one in win3.1

the code i have do all the job but i can't find how to save that to a file
for later play back
and that's the problem i have

thank you forthe time you take to help me

Georges
 
C

Cor Ligthert[MVP]

Gillard,

I have looked at your code before, and did not understand like Patrice what
you wanted to serialize.

Now I look again I get the idea that you want to serialize an already
serialized file.

Here is a link to our pages where you see a simple sample how easy
serializing is.

http://www.vb-tips.com/SerializeArrayList.aspx

However like Patrice wrote as well to serialize something the class (type)
needs the attribute that it is serializable.

A lot of .Net classes are marked as not serializable.

As this sample does not solve your problem, then try to bring your problem
back to the essention, as that does not help you then rephrase your problem
here.

Cor
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top