Serialize And Deserialize A Structure?

Aug 3, 2009

Is it possible to serialize and deserialize a structure?

I think it isn't because the code I use will not work for a structure but it does work for other data types like an array, string etc

View 3 Replies


ADVERTISEMENT

DeSerialize And Serialize From XML To XML?

Jan 13, 2011

I am trying to read in an XML document, add a record with a tag for the filename and write to a different XML document.I have been told I must use serialization.

View 2 Replies

Add XML Comment During Serialize/deserialize?

Mar 31, 2009

I have an XML document that I am deserializing (VB .NET 3.5 Framework), changing some values, and the serializing again. The original document has several XML Comments in it. When I go through all the deserialize/serialize all of the comments are lost. Is there a way to preserve the comments? If not, is there a way to add comments on serialization without having to walk through with the writer and manually add all of the comments back in the appropriate place?

View 1 Replies

Serialize And Deserialize A Form?

Aug 7, 2010

How do I serialize and deserialize my main form (and its controls, subcontrols, their values, etc.)? Edit, for clarification. Currently I am writing the current value of each control to an .INI file, one by one and reading it back when the program is next run. Every time I add a new control, I have to remember to update that save/load .INI code.I just wondered if I can do it in one call, or a simple for loop iterating over all controls on the form.Btw, I use only simple controls like edit box, radio button, combo box, checkd listbox, the most complex thing I have is a datagrid, but even that is not linked to a databse.Accepted answer "can't. I will probably code my own, along the lines of ...

[code]...

maybe later add left/top/height/width/enabled/visible, etc, bu tfor not th econtrol name an its "value" are enough (text, value, lines, checked?, etc)

View 2 Replies

Serialize/deserialize Data In Vb?

Jun 11, 2009

I'm trying to serialize/deserialize data in vb. I've made a .dat file from a blank plain text file (not sure if this is suitable) which seems to connect ok, as do both the classes. Here's the

Imports Microsoft.VisualBasic.ControlChars
Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary

[Code]....

View 6 Replies

C# - Serialize/deserialize A HTML Table In .NET?

Jan 26, 2012

I am trying to write a class to serialize/deserialize something as simple as:

<table border="1">
<tr>
<td>row 1, cell 1</td>

[Code]....

I just can't get it to serialize to this thing. I tried to generate the class using xsd but that produced a lot of garbage code and I really would like to maintain this by hand as it is easier than the monstrosity that xsd produced which didn't work anyway.

View 3 Replies

Serialization - Serialize / Deserialize With References

Dec 5, 2011

I have a 2 collection of varying objects. Let's say I have the following two objects Private col1 as Collection(Of A) and Private col2 as Collection(Of B) But object of Type A has a collection of Type B as an Attribute. so A looks like that

[Code]...

View 1 Replies

C# - Serialize List Of Objects In Android And Deserialize In WCF?

Apr 17, 2012

I have an ArrayList in android that I'm trying to convert to a Base64 String, then passing that to a wcf service though JSON and the wcf service inserts the string into a database. Then I need to be able to read that from the database and deserialize it in a .NET application.

This is how I am serializing the ArrayList in android:

private String convertByteArrayToSave(byte[] b){
if(b != null){
return Base64.encodeToString(b,0,b.length,Base64.DEFAULT);
}else{

[Code]...

The ultimate goal is to be able to be able to create a list of these shapes in the .NET app or android app and be able to read the list in the .NET app and android app no matter where it was created from. I'm able to it when you create the Shape from .NET and read it into android using WCF but creating it in android.

View 1 Replies

Serialize A Picturebox With All It's Child Controls And Deserialize It

Nov 15, 2010

I have a question about serializing a Picturebox and it's child controls. I have a picturebox on my main form where a user can put new Picture boxes in.To a add a new Picturebox I say: Pictureboxmain.controls.add(Picturebox)But now I want to serialize this in a stream of bytes. I know that you can serialize an Arraylist as followed:[code]But is the same possible with a collection of controls?So now I tried this assuming the same method can be used with a control collection:[code]

View 9 Replies

The New Serialize/Deserialize For Express 2010 Not Working?

Nov 4, 2010

Module ProjectSerializer

Sub Serialize(ByVal strPath As String, ByVal ProjInfo As ProjectInfo)
' create a filestream to allow saving the file after it has
' been serialized in this method

[code]....

View 7 Replies

Serialize/Deserialize "unable To Find Assembly" 2 Projects?

Mar 1, 2012

The general idea of whats going on is i am trying to transfer a structure from one project to another using binary and sending through a TCP Stream. What I Did:In my server i serialized the structure Maps(Map) to a temp file. Then I read all the bytes from the temp file to my buffer and sent it off to my client project.

[Code]...

View 5 Replies

Serialize A Structure To XML?

Feb 27, 2010

I'm writing a test application in order to figure out how to serialize a structure to XML. I can not get the following code to work for me and it's not obvious to me.

The following defines the structures I am attempting to serialize. I think I have the xml decoration correct - but the errors I'm receiving (see below) don't really give me much information.

Imports System.IO
Imports System.Xml.Serialization
Public Module modTestSerialization

[Code]....

View 2 Replies

Class/structure To Serialize JSON?

Mar 9, 2011

I am trying to figure out a class/struture to handle the following JSON format:

{
"ReturnData": [
{
"id": "msg2DoesNotExistName",

[Code]......

I may or may not have Data for ReturnData and SetValue (one or both at a minimum). I am trying to let the serializer handle most of the formatting without having to check for empty sections and single-item arrays.

View 1 Replies

Serialize Structure Duplicate The Size?

Sep 28, 2011

I am using simple Serialize Structure to save files with some information in one file like this:

<Serializable()> Structure MyFileSystemStructure
Public FilesNames() As String
Public FilesBytes()() As Byte

[Code].....

The problem that is the result file size when saving structure of image 200KB, will be 400KB

All generated bytes after number 200 are clean (zero value).

View 16 Replies

VS 2008 - Serialize Array Of Structure To XML

Jun 3, 2010

I desperately seek for a code sample to serialize an array of structure elements to a XML. To serialize a simple object of a structure I used:
Private Sub saveEntries()
Dim FS As New FileStream(path, FileMode.Create)
Dim XS As New XmlSerializer(GetType(personEntry))
XS.Serialize(FS, entries(0)) 'serialize first entry of an array - success
FS.Close()
End Sub

Structure looks like this:
<Serializable()> Public Structure personEntry
Dim name As String
Dim d, m, y As Integer
End Structure
Private path As String = "data_file.xml"
Public entries(2) As personEntry
But how to apply this to an array?

View 5 Replies

Serialize A Data Structure And Pass It To Another Report Via Parameter?

Jan 15, 2010

I'm trying to serialize a data structure and pass it to another report via parameter, and this line of code:

Dim s As New System.Xml.Serialization.XmlSerializer(GetType(System.Collections.HashTable))

Produces this error:

An error occurred during local report processing. The definition of the report '/myReport' is invalid. There is an error on line 22 of custom code: [BC30002] Type 'System.Xml.Serialization.XmlSerializer' is not defined.

How can I get around this? I have been able to use fully defined .NET classes in other lines of code, including the following:

Dim outStream As New System.IO.StringWriter()

and

Private colorMapping As New System.Collections.Hashtable()

View 1 Replies

VS 2008 Serialize A Class That Implements An Event That Don't Want To Serialize?

Aug 17, 2010

If a class is serialized and has events fired from it that are handled on a form you get the error "Form1 cannot be serialized" in c# you can use (to work around this):

[Code]....

View 1 Replies

Structure Inside Another Structure Receives Null Reference Error?

Jan 5, 2012

Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module

View 17 Replies

Class Structure - Large Structure That Has Lots Of Properties ?

Jan 5, 2010

I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.

Let's say I have a pretty large structure that has lots of properties.

Code:

Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)

Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.

Code:

Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?

In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.

View 11 Replies

Converting Structure Within Structure To Byte Array For Socket

Aug 29, 2009

I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.

I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.

Public Structure MESSAGETYPE_OIP_Login
Dim Header() As COMMANDHEADER
Dim UserName() As PSTRING

[Code]....

View 2 Replies

Invalid Structure Size When Marshalling C Structure To .NET

Apr 14, 2012

I'm experiencing a problem with the following c-structure:

typedef struct tagTEXTUREPROP
{
DWORD dwSize;

[Code].....

The Marshal.SizeOf obviously calculates a size of 76 and it works with the DLL function, but it leaves me with some bad feelings.

View 1 Replies

VS 2008 Convert The XML Structure Into A Class Structure?

Apr 25, 2010

I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).

The XML document looks like this:

xml
<?xml version="1.0" encoding="utf-8"?>
<artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">

[code]....

View 2 Replies

How To Deserialize AMF In VB

Dec 17, 2010

I can't find any example about how to deserialize AMF in vb.net. I found one in C# but i don't know how to make it working for VB. Someone is able to show me an example of parsing AMF, simple client?

View 5 Replies

VS 2008 Deserialize XML?

Nov 3, 2011

HTML Dim Geocache As FileStream = New FileStream("c:emps.gpx", FileMode.Open)Dim serialize As XmlSerializer = New XmlSerializer(GetType(Cache_Location))Dim myLocation As Cache_Location = New Cache_Location

[Code]....

View 2 Replies

XML Deserialize To Class?

Jun 29, 2012

Ok, so I'm playing with some FTP profile files that are written in XML. I'm trying to get the program to be able to read the current users settings and fill in or remove servers they do or don't have access to. So the XML looks like

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<ftp>
<servers>

[code].....

it's probably more cosmetic than anything but the logic just doesn't flow to look over 'server' and not 'servers'?!

View 8 Replies

Arraylist Of Structure Within Array Of Structure?

May 23, 2010

I want to make a structure within a structure. Basically it will appear like this:

Structure ID
dim CardType as string
im CardCode as string

[code]......

View 13 Replies

Assign Array Of Structure To Another Of Same Structure?

Oct 12, 2010

In Vb.net I am trying to assign an array of structure to another array of same structure[code]...

View 2 Replies

Deserialize A JSON String

Feb 25, 2012

I am trying to deserialize a JSON string using VB.net and cannot seem to pull the values out of the finished List.[code]I am told "Index was out of range. Must be non-negative and less than the size of the collection."

View 1 Replies

.net - Deserialize JSON Into An Object?

Sep 13, 2011

I'm having an issue with getting some of the values from with this json string:

{
"kind": "shopping#products",
"etag": ""YZWJaKE3MHROIW8rCIlu9mAACLM/6qxBB-GwuSPy5L3_zVS6sS2NYFI"",
"id": "tag:google.com,2010:shopping/products",
"selfLink": "https://www.googleapis.com/shopping/search/v1/public/products?country=US&

[code]....

View 2 Replies

.net - JSON.Net VB Deserialize Not Working?

Mar 18, 2011

I'm new to VB and trying to write a webservice that exports and imports JSON.I'm using JSON.NET 3.5 and can serialize fine:My Token class is:

<DataContract()> _
Public Class Token
<DataMember()> _
Public TokenID As String
<DataMember()> _
Public Issued As Date

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved