Serialize A Listview Using .net?
Nov 7, 2009how to serialize a listview using vb.net
View 1 Replieshow to serialize a listview using vb.net
View 1 RepliesIf 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]....
I have the following code which works well:
Dim dept As New ArrayList
Dim forename As New ArrayList
objJSONStringBuilder = New StringBuilder()
[Code].....
Eventually, I will want to add more columns, i.e. surname.
I am trying to call a rest service..that service returns json object...I am able to send the request but unable to serialize the json...here is the code i am trying
[Code]...
This is for a web project so i have several classes that inherit from Web.UI.
I only want to serialize very particular properties (basically, only local properties)
I'm aware of the XMLIgnore property that can be placed on a property to ignore items, but this won't work in my context since that would require modifying a bunch of stuff that i really don't want to modify (and probably can't).
So how do i tell the xml serializer to ignore everything except for X and Y or tell it to seralize just X and Y?
i could just create my own xml in a string builder or something and if that's the only way, so be it. however i'm looking for a method that will employ the built in XML stuff.
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 RepliesI have a hash table in which the key is of type Point and the value is of type PieceOfBoard. PieceOfBoard is derived from PictureBox. How do I serialize this hashtable to save it to a file?Do I need to add anything to the PieceOfBoard class?
View 3 RepliesHow can I serialize a .net object into XML and then de-serialize it back?
View 3 RepliesI'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]....
Is it possible to serialize a toolstrip?
View 1 RepliesI need a way to transfer a compiled assembly from client to the server and be able to store that in the database or in a file in such a way that I can grab those bytes on the "to" side and re-load assembly. Is there a way to do it. To clarify, I have a winforms application that will generate code and compile it based on some metadata. Now I need to be able to transfer this to a web site and store it somehow, but I don't want a dll (because it can be de-compiled). I would then have a "server" program on the to side, that would load this in memory. I could just transfer encrypted source code, but I thought I could just transfer compiled assembly.
View 4 RepliesI am having an issue using BinaryFormatter.Serialize. I have this generic extension method to "clone" an object via binary serialization:
[Code]...
This is killing performance. Anything more that about 7 or 8 clones brings the app to a halt. Why would this happen? The USING block ought to ensure the MemoryString is disposed of, right? Shouldn't a new MemoryString be created each time? I would think since the same original Mode object is the source for the serialization, the MemoryString length would be the same.
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 RepliesI have the following code which serialize an array to json:
Dim col1 As New ArrayList
Dim col2 As New ArrayList
objJSONStringBuilder = New StringBuilder()
objSQLConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("connString"))
objSQLCommand = New SqlCommand("select col1, col2 from table1", objSQLConnection)
objSQLCommand.Connection.Open()
[Code]...
I have a 3D Engine which renders a 3D World onto any vb.net object with an HWND(Handle) -Picturebox or Form using Direct3D.What I'd like to do is stream that image over my LAN. I know its probably a weird idea, but I have a plan.Since the image is 'rendered' onto the object, the objects 'Image' Property is null, so sending that to a byte array doesn't do any good.Now, I've tried using the picturebox.drawtobitmap function, but it is far to slow for what I'm intending.I've used several functions in the Graphics control to try and get the image data off that picturebox, but to no avail.I've even tried sampling the surface data from Direct3D but none of these objects are able to be converted to a byte array.
View 2 RepliesIs it possible to serialize an arraylist of objects into xml?Its damn urgent.Kindly reply.
View 1 RepliesI need to look at the properties of an object and I cannot instantiate this object in the proper state on my dev machine. I need my client to run some code on her machine, serialize the object in question to disk and then I can analyze the file.[code]...
View 2 RepliesI'm trying to serialize a data table in vb.net:
Dim dt As New System.Data.DataTable
and for the serializer:
Dim js As JavaScriptSerializer = New JavaScriptSerializer()
dim jsonString as string
jsonString=js.serialize(dt)
when it serialize the data table on the last line,it got an error:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Web.Extensions.dll Additional information: A circular reference was detected while serializing an object of type 'System.Globalization.CultureInfo'I even make the simplest datatable with only 1 column and 1 row, but it just won't serialize it?
It is my first time trying to serialize an array into xml list. Couldn't really find a nice tutorial out there on xml.
I have
dim Array() as integer = {1,2,3}
dim Value() as string= {Value1,Value2,Value3}
When the array is serialize, i guess, i want to try to get the format to look like below:
<p data="Value1">1</p>
<p data="Value2">2</p>
<p data="Value3">3</p>
How o it serialize into this format, and de-serialize back into an array?
what is the fastest way to serialize and compress a class?
what are the consideration to be made when a long list of objects(classes) have to be serialized and compressed one after the other?
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)
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
In MVC I can do something like the following to serialise an object with an anonymous type to JSON.[code]I'd like to do exactly the same but output xml. I haven't been able to find an equivalent method. Would someone please point me in the right direction?
View 2 RepliesI'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]....
I have an XML file:
<?xml version="1.0" encoding="UTF-8"?>
<MyProducts>
<Product Name="P1" />
[code].....
I know how to seralize my arraylist to xml using vb.net?
View 2 RepliesI'm trying to serialize this class:
<System.Serializable()> Public Class Person
Private _FirstName As String
Public Property FirstName() As String
[code]....
I have a few classes (about 15 or so) in VB.net (2005) that I would like to be able to serialize to xml. Unfortunately they are labeled as friend classes and cannot be exposed outside of the assembly.The assembly is a dll that is a com interop plugin to a CAD system. I have set all of my classes as friends so that they are not exposed outside of the assembly for 3rd party use. I am wondering if I even need to do that. Setting the class to public would allow me to serialize things. However I don't want people linking to the assembly and using the classes.Should I even worry about other programs linking to my assembly? In fact I don't think there is a large chance of this happening. I just don't like the idea of having almost all of my classes with a public scope.Is there a way to make a friend class serializable?
View 2 RepliesI have a VB.NET subroutine that is triggered by a timer. I have found that on occasion, if the routine runs for a long time, the routine will be triggered again while it is still running with unpredictable results. Is this normal? Is each copy of the routine running in its own thread? Is there a way to serialize the routines? Right now I use a Boolean that I set True on entry and False when I am done so I can check if the routine is running when I enter it, but I thought that there might be something more elegant.
View 2 RepliesUsing the following code:
Private Sub MakeMeSomeXmlBeforeRyanGetsAngry()
Dim db As New MyDBDataContext
Dim customer = From c In db.Customers Select c
[code]....
I am attempting to serialize my linq collection of customers. But it keeps throwing
Type 'System.Data.Linq.DataQuery`1[MyDB.Customer]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types. My issue is that I have already marked the dbml Serialization Mode to UniDirectional and when I check the dbml codebehind all of the DataContract()> and DataMember()> elements are there. I have tried adding various dataloadoptions and setting deferredloading to false, but no luck.