Prev: insert control to parent at reverse order.
Next: A Way for saving control with all of it's components and propertiesto a file or stream.
From: Mr. X. on 16 Jun 2010 07:56 Hello. Is there any way to save a control + all of it's components to a file (or give it some representation as a long string). Thanks :)
From: Cor Ligthert[MVP] on 16 Jun 2010 13:00 http://msdn.microsoft.com/en-us/library/aa289499(VS.71).aspx "Mr. X." <nospam(a)nospam_please.com> wrote in message news:e6zSMsUDLHA.3776(a)TK2MSFTNGP04.phx.gbl... > Hello. > Is there any way to save a control + all of it's components to a file (or > give it some representation as a long string). > > Thanks :) >
From: Onur Güzel on 16 Jun 2010 14:20 On Jun 16, 2:56 pm, "Mr. X." <nospam(a)nospam_please.com> wrote: > Hello. > Is there any way to save a control + all of it's components to a file (or > give it some representation as a long string). > > Thanks :) Maybe you're looking at object serialization to save a serializable object on the disk. This search may lead you to start: http://www.google.com/search?hl=en&client=firefox-a&hs=5Ad&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+object+serialization&aq=f&aqi=g-c1&aql=&oq=&gs_rfai= HTH, Onur Güzel
From: Mr. X. on 20 Jun 2010 03:22 I would like to learn more about serialization. The code I did is : Dim f As System.IO.FileStream Dim binFormat As New BinaryFormatter f = nothing try f = New FileStream("items.txt", FileMode.Create) binFormat.Serialize(f, MyPanel) finally f.close() end try MyPanel is declared as Panel. (dim myPanel as Panel ...) Even I create myPanel as this : Public Class MyPanelClass Inherits Panel Implements ISerializable Public Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) Implements System.Runtime.Serialization.ISerializable.GetObjectData Dim i As Integer i = 1 ' this code is not reachable **** what should I write here. need an example, please *********************** End Sub End Class .... dim myPanel as MyPanelClass .... I need a simple sample (specifically : saving panel & objects on it). Thanks :) "Onur G�zel" <kimiraikkonen85(a)gmail.com> wrote in message news:99a7b09b-d1ad-4e76-91bd-b729d564bbfa(a)d37g2000yqm.googlegroups.com... > On Jun 16, 2:56 pm, "Mr. X." <nospam(a)nospam_please.com> wrote: >> Hello. >> Is there any way to save a control + all of it's components to a file (or >> give it some representation as a long string). >> >> Thanks :) > > Maybe you're looking at object serialization to save a serializable > object on the disk. This search may lead you to start: > > http://www.google.com/search?hl=en&client=firefox-a&hs=5Ad&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+object+serialization&aq=f&aqi=g-c1&aql=&oq=&gs_rfai= > > HTH, > > Onur G�zel
From: Onur Güzel on 20 Jun 2010 05:13
On Jun 20, 10:22 am, "Mr. X." <nospam(a)nospam_please.com> wrote: > I would like to learn more about serialization. > The code I did is : > Dim f As System.IO.FileStream > Dim binFormat As New BinaryFormatter > > f = nothing > try > f = New FileStream("items.txt", FileMode.Create) > > binFormat.Serialize(f, MyPanel) > finally > f.close() > end try > > MyPanel is declared as Panel. (dim myPanel as Panel ...) > Even I create myPanel as this : > Public Class MyPanelClass > Inherits Panel > Implements ISerializable > > Public Sub GetObjectData(ByVal info As > System.Runtime.Serialization.SerializationInfo, ByVal context As > System.Runtime.Serialization.StreamingContext) Implements > System.Runtime.Serialization.ISerializable.GetObjectData > Dim i As Integer > i = 1 ' this code is not reachable **** what should I write > here. need an example, please *********************** > End Sub > End Class > > ... > dim myPanel as MyPanelClass > ... > > I need a simple sample (specifically : saving panel & objects on it). > > Thanks :) > > "Onur Güzel" <kimiraikkone...(a)gmail.com> wrote in message > > news:99a7b09b-d1ad-4e76-91bd-b729d564bbfa(a)d37g2000yqm.googlegroups.com... > > > On Jun 16, 2:56 pm, "Mr. X." <nospam(a)nospam_please.com> wrote: > >> Hello. > >> Is there any way to save a control + all of it's components to a file (or > >> give it some representation as a long string). > > >> Thanks :) > > > Maybe you're looking at object serialization to save a serializable > > object on the disk. This search may lead you to start: > > >http://www.google.com/search?hl=en&client=firefox-a&hs=5Ad&rls=org.mo... > > > HTH, > > > Onur Güzel Well, you serialize classes which are marked with "<Serialiable()>" attribute such as arrays and strings, in that case the panel base class doesn't seem to have this attribute and thus its members cannot be serialized, and you'll get SerializationException error. http://msdn.microsoft.com/en-us/library/system.windows.forms.panel.aspx If your own class or any .NET class had this attribute, you could easily have serialized and deserialized its fields/members like in the followings: http://devcity.net/Articles/113/1/dotnet_serialization.aspx http://devcity.net/Articles/113/1/dotnet_serialization.aspx http://www.java2s.com/Tutorial/VB/0240__Stream-File/0480__Binary-Serialization.htm HTH, Onur Güzel |