Windows Form saving

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siva211662
    New Member
    • Nov 2008
    • 1

    Windows Form saving

    I want to save windows form and controls (text box,button,user control.. ) along with there properties to hard disk or Database at run time.I tried using with serialization but i am facing some problems like events,form we can't serialize ...Is there any good solution for saving form into disk or Database.

    After resorting form also i can able to modify restored form and its controls properties.
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    Take a look at this :
    From copy
    Serialize windows froms

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      What do you mean by "save"? I mean the form is already saved in your project, and all the designer-creation stuff is in the built application.

      Are you talking about saving the size of the window and other things the user changes? You can either use the registry or the built in "Properties " section of the project to save the settings.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by Plater
        What do you mean by "save"?...
        They probably mean serialize as assumed by DeepBlue. Basically writing the C# objects to a file and retrieving them again without having to destroy and create again from scratch.

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Well I'm not clear how that's usefull unless you're passing the serialized data accross networks (and that seems security hole to me)
          Plus, the OP already said serializing was no good because it didn't do the eventhandler wireups

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by Plater
            Well I'm not clear how that's usefull unless you're passing the serialized data accross networks (and that seems security hole to me)
            Plus, the OP already said serializing was no good because it didn't do the eventhandler wireups
            Perhaps in large and complex GUIs where GUI construction takes lots of time/processing power. I wouldn't be surprised about the other stuff not being correctly serialized. Not every .NET object is serializable out of the box.

            Comment

            • balabaster
              Recognized Expert Contributor
              • Mar 2007
              • 798

              #7
              It seems to me (without knowing anything about the application) that this type of functionality could be useful if you're trying to allow custom forms to be added dynamically to the application by an application user without needing to recompile. I went part way towards this by allowing custom code to be added to an application by users... I've never done this with full forms, though I imagine a similar (but modified) approach could be taken to do this...

              Of course, I don't understand what the OP is trying to achieve, so I can't say for sure that I'd recommend this approach...

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by balabaster
                It seems to me (without knowing anything about the application) that this type of functionality could be useful if you're trying to allow custom forms to be added dynamically to the application by an application user without needing to recompile. I went part way towards this by allowing custom code to be added to an application by users... I've never done this with full forms, though I imagine a similar (but modified) approach could be taken to do this...

                Of course, I don't understand what the OP is trying to achieve, so I can't say for sure that I'd recommend this approach...
                That would be creating widgets, easily achievable by creating reusable classes. Saving state by serialization on the other hand is different. The best example I can give is the hibernate function. You basically save your object's state and then reload those objects again later.

                Comment

                • balabaster
                  Recognized Expert Contributor
                  • Mar 2007
                  • 798

                  #9
                  Originally posted by r035198x
                  That would be creating widgets, easily achievable by creating reusable classes. Saving state by serialization on the other hand is different. The best example I can give is the hibernate function. You basically save your object's state and then reload those objects again later.
                  Could that not be done with a statebag? To persist a form's state?

                  Comment

                  Working...