Serialize a Form.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • objectref

    Serialize a Form.

    Hi to all,

    let's say i have a form with 2 buttons and 3 textboxes on it.
    Is there a way to Serialize the form so when i de-Serialize
    and cast it to a Form, i will get back the original form with the textboxes
    filled with their original values ??

    I have built an app that i want to have the values of many-many forms'
    controls
    on the disk and then all the values back to the forms,
    so i need a way to do this...

    Thanks a lot for any help,

    objectref


  • Salvador

    #2
    RE: Serialize a Form.

    Hi,

    I think that a form is non-serializable, so I recommend you to build a
    struct with the values and serialize the struct, it is also a good practice.

    Hope this helps
    Salva


    "objectref" wrote:
    [color=blue]
    > Hi to all,
    >
    > let's say i have a form with 2 buttons and 3 textboxes on it.
    > Is there a way to Serialize the form so when i de-Serialize
    > and cast it to a Form, i will get back the original form with the textboxes
    > filled with their original values ??
    >
    > I have built an app that i want to have the values of many-many forms'
    > controls
    > on the disk and then all the values back to the forms,
    > so i need a way to do this...
    >
    > Thanks a lot for any help,
    >
    > objectref
    >
    >
    >[/color]

    Comment

    • objectref

      #3
      Re: Serialize a Form.

      Hey Salvador,

      thanks for the fast reply!

      Well, i really have a structure-system designed on the paper but this will
      require me
      to have different code in each form (the forms are different) to
      serialize/de-serialize itself.

      I know that Form isn't serializable but i was hoping for a way not known to
      me
      to do this task a little more automatic!

      Bute heym thanks again!

      objectref


      "Salvador" <Salvador@discu ssions.microsof t.com> wrote in message
      news:C2CF4F61-96B3-493C-98B8-C6FAB064CE1D@mi crosoft.com...[color=blue]
      > Hi,
      >
      > I think that a form is non-serializable, so I recommend you to build a
      > struct with the values and serialize the struct, it is also a good
      > practice.
      >
      > Hope this helps
      > Salva
      >
      >
      > "objectref" wrote:
      >[color=green]
      >> Hi to all,
      >>
      >> let's say i have a form with 2 buttons and 3 textboxes on it.
      >> Is there a way to Serialize the form so when i de-Serialize
      >> and cast it to a Form, i will get back the original form with the
      >> textboxes
      >> filled with their original values ??
      >>
      >> I have built an app that i want to have the values of many-many forms'
      >> controls
      >> on the disk and then all the values back to the forms,
      >> so i need a way to do this...
      >>
      >> Thanks a lot for any help,
      >>
      >> objectref
      >>
      >>
      >>[/color][/color]


      Comment

      • Salvador

        #4
        Re: Serialize a Form.

        Hi,

        If you need to use a multiple form loader you can have a static function
        that receives the stream and the form reference and serialize/deserialize the
        complete values, of course if the forms are of the same type. Otherwise is
        quite tediuous!

        :)

        Cheers
        Salva


        "objectref" wrote:
        [color=blue]
        > Hey Salvador,
        >
        > thanks for the fast reply!
        >
        > Well, i really have a structure-system designed on the paper but this will
        > require me
        > to have different code in each form (the forms are different) to
        > serialize/de-serialize itself.
        >
        > I know that Form isn't serializable but i was hoping for a way not known to
        > me
        > to do this task a little more automatic!
        >
        > Bute heym thanks again!
        >
        > objectref
        >
        >
        > "Salvador" <Salvador@discu ssions.microsof t.com> wrote in message
        > news:C2CF4F61-96B3-493C-98B8-C6FAB064CE1D@mi crosoft.com...[color=green]
        > > Hi,
        > >
        > > I think that a form is non-serializable, so I recommend you to build a
        > > struct with the values and serialize the struct, it is also a good
        > > practice.
        > >
        > > Hope this helps
        > > Salva
        > >
        > >
        > > "objectref" wrote:
        > >[color=darkred]
        > >> Hi to all,
        > >>
        > >> let's say i have a form with 2 buttons and 3 textboxes on it.
        > >> Is there a way to Serialize the form so when i de-Serialize
        > >> and cast it to a Form, i will get back the original form with the
        > >> textboxes
        > >> filled with their original values ??
        > >>
        > >> I have built an app that i want to have the values of many-many forms'
        > >> controls
        > >> on the disk and then all the values back to the forms,
        > >> so i need a way to do this...
        > >>
        > >> Thanks a lot for any help,
        > >>
        > >> objectref
        > >>
        > >>
        > >>[/color][/color]
        >
        >
        >[/color]

        Comment

        • Lebesgue

          #5
          Re: Serialize a Form.

          This may help you
          "How to serialize windows Form object to Binary stream"


          "Salvador" <Salvador@discu ssions.microsof t.com> wrote in message
          news:016B6A81-389D-4CB5-BB16-AC85024C5E7B@mi crosoft.com...[color=blue]
          > Hi,
          >
          > If you need to use a multiple form loader you can have a static function
          > that receives the stream and the form reference and serialize/deserialize[/color]
          the[color=blue]
          > complete values, of course if the forms are of the same type. Otherwise is
          > quite tediuous!
          >
          > :)
          >
          > Cheers
          > Salva
          >
          >
          > "objectref" wrote:
          >[color=green]
          > > Hey Salvador,
          > >
          > > thanks for the fast reply!
          > >
          > > Well, i really have a structure-system designed on the paper but this[/color][/color]
          will[color=blue][color=green]
          > > require me
          > > to have different code in each form (the forms are different) to
          > > serialize/de-serialize itself.
          > >
          > > I know that Form isn't serializable but i was hoping for a way not known[/color][/color]
          to[color=blue][color=green]
          > > me
          > > to do this task a little more automatic!
          > >
          > > Bute heym thanks again!
          > >
          > > objectref
          > >
          > >
          > > "Salvador" <Salvador@discu ssions.microsof t.com> wrote in message
          > > news:C2CF4F61-96B3-493C-98B8-C6FAB064CE1D@mi crosoft.com...[color=darkred]
          > > > Hi,
          > > >
          > > > I think that a form is non-serializable, so I recommend you to build a
          > > > struct with the values and serialize the struct, it is also a good
          > > > practice.
          > > >
          > > > Hope this helps
          > > > Salva
          > > >
          > > >
          > > > "objectref" wrote:
          > > >
          > > >> Hi to all,
          > > >>
          > > >> let's say i have a form with 2 buttons and 3 textboxes on it.
          > > >> Is there a way to Serialize the form so when i de-Serialize
          > > >> and cast it to a Form, i will get back the original form with the
          > > >> textboxes
          > > >> filled with their original values ??
          > > >>
          > > >> I have built an app that i want to have the values of many-many[/color][/color][/color]
          forms'[color=blue][color=green][color=darkred]
          > > >> controls
          > > >> on the disk and then all the values back to the forms,
          > > >> so i need a way to do this...
          > > >>
          > > >> Thanks a lot for any help,
          > > >>
          > > >> objectref
          > > >>
          > > >>
          > > >>[/color]
          > >
          > >
          > >[/color][/color]


          Comment

          • objectref

            #6
            Re: Serialize a Form.

            Yes Lebesgue,

            it helped me a lot !

            Now, instead of doing a general routine that will save/load form's control
            variables,
            i will build each form a routine that do just that, especially for each
            form!

            thanks a lot!

            objectref

            "Lebesgue" <nospam@spam.jp > wrote in message
            news:e3DJclfPFH A.508@TK2MSFTNG P12.phx.gbl...[color=blue]
            > This may help you
            > "How to serialize windows Form object to Binary stream"
            > http://216.26.160.137/Forums/AspNetF...x?PostID=17410
            >
            > "Salvador" <Salvador@discu ssions.microsof t.com> wrote in message
            > news:016B6A81-389D-4CB5-BB16-AC85024C5E7B@mi crosoft.com...[color=green]
            >> Hi,
            >>
            >> If you need to use a multiple form loader you can have a static function
            >> that receives the stream and the form reference and serialize/deserialize[/color]
            > the[color=green]
            >> complete values, of course if the forms are of the same type. Otherwise
            >> is
            >> quite tediuous!
            >>
            >> :)
            >>
            >> Cheers
            >> Salva
            >>
            >>
            >> "objectref" wrote:
            >>[color=darkred]
            >> > Hey Salvador,
            >> >
            >> > thanks for the fast reply!
            >> >
            >> > Well, i really have a structure-system designed on the paper but this[/color][/color]
            > will[color=green][color=darkred]
            >> > require me
            >> > to have different code in each form (the forms are different) to
            >> > serialize/de-serialize itself.
            >> >
            >> > I know that Form isn't serializable but i was hoping for a way not
            >> > known[/color][/color]
            > to[color=green][color=darkred]
            >> > me
            >> > to do this task a little more automatic!
            >> >
            >> > Bute heym thanks again!
            >> >
            >> > objectref
            >> >
            >> >
            >> > "Salvador" <Salvador@discu ssions.microsof t.com> wrote in message
            >> > news:C2CF4F61-96B3-493C-98B8-C6FAB064CE1D@mi crosoft.com...
            >> > > Hi,
            >> > >
            >> > > I think that a form is non-serializable, so I recommend you to build
            >> > > a
            >> > > struct with the values and serialize the struct, it is also a good
            >> > > practice.
            >> > >
            >> > > Hope this helps
            >> > > Salva
            >> > >
            >> > >
            >> > > "objectref" wrote:
            >> > >
            >> > >> Hi to all,
            >> > >>
            >> > >> let's say i have a form with 2 buttons and 3 textboxes on it.
            >> > >> Is there a way to Serialize the form so when i de-Serialize
            >> > >> and cast it to a Form, i will get back the original form with the
            >> > >> textboxes
            >> > >> filled with their original values ??
            >> > >>
            >> > >> I have built an app that i want to have the values of many-many[/color][/color]
            > forms'[color=green][color=darkred]
            >> > >> controls
            >> > >> on the disk and then all the values back to the forms,
            >> > >> so i need a way to do this...
            >> > >>
            >> > >> Thanks a lot for any help,
            >> > >>
            >> > >> objectref
            >> > >>
            >> > >>
            >> > >>
            >> >
            >> >
            >> >[/color][/color]
            >
            >[/color]


            Comment

            Working...