Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a struct in vb.net like:

 

structure test

dim element1 as string

dim element2 as integer

dim element3 as bool

end structure

 

dim varTest as test

 

 

I want to write and read the whole struct variable varTest

in a file.

 

I already try with fileput command like

 

fileput(freefile,binarymodeRead,varTest)

and it looks like it work

 

but when I try to read de struct with fileget

fileget(freefile,binarymodeWrite, varTest)

the app give me this error

 

Is there another way to read/write the whole struct into or from

a file.

  • *Experts*
Posted

I would recommend looking into XML Serialization for doing things like that. XML Serialization the object or objects you want to write to a file a lays them out in an XML file. If you search Google for XML Serialization you should find a lot of examples and tutorials. And then use Deserialization to read back the file.

:)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...