Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What technique do you use to persist state?

What technique do you use to persist state?

Scheduled Pinned Locked Moved The Lounge
csharpquestionphprubycss
40 Posts 25 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nagy Vilmos

    Dang Marc, have you been reading my hard drive again? I have a data class that contains named value pairs and supports String, Integer, Double, Date and Boolean values. These can be read from file in a simple format and used to persist state. The data class is also used for passing between services. It is my general throw around format. I need to work out an article for just this as I have 3-4 more that all use it so the DataSet becomes a pre-requisite article to write. One day...

    Reality is an illusion caused by a lack of alcohol

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #10

    Nagy Vilmos wrote:

    Dang Marc, have you been reading my hard drive again?

    How is he going to be able to do that? The powere keeps going off and you cannot get a good read on anything.

    Every man can tell how many goats or sheep he possesses, but not how many friends. Shed Petition[^]

    1 Reply Last reply
    0
    • M Marc Clifton

      No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

      Latest Article: C# and Ruby Classes: A Deep Dive
      My Blog

      M Offline
      M Offline
      Marco Bertschi
      wrote on last edited by
      #11

      App option specific stuff locally on the machine of the client. If there is a server everything else goes there into a database. Else I use depending on the amount of data a SQLite DB or XML/CSV files located in the AppData for everything.

      cheers Marco Bertschi


      Software Developer & Founder SMGT Web-Portal CP Profile | My Articles | Twitter | Facebook | SMGT Web-Portal Freedom, son, is a dirty shirt - The Boss

      1 Reply Last reply
      0
      • M Marc Clifton

        No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

        Latest Article: C# and Ruby Classes: A Deep Dive
        My Blog

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #12

        A combination of things. For the simple stuff such as UI persistence, I use Application.Config: Save and restore your form size and location[^] For more complex data I try to stick to DB-like data, with SqlCE files or XML if I want human readable. I also have a encryption class which has a file option for more secure data - but the data I serialise to that is normally XML.

        If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • M Marc Clifton

          No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

          Latest Article: C# and Ruby Classes: A Deep Dive
          My Blog

          E Offline
          E Offline
          Ennis Ray Lynch Jr
          wrote on last edited by
          #13

          Back when I was a teenager, I thought saving UI State was all the rage but I soon gave it up. The massive amount of code required to store and manage it and make it all perfect just wasn't worth it. Heck, even today, I have a problem when I load firefox at home. You see I have a laptop hooked up to another monitor. However, that monitor is also wired to another machine. When the other machine is on, Windows on the laptop works fine but when I open something that was previously opened on the second monitor guess where it opens? If Windows and Firefox can't manage to get UI saving settings right why even bother? Plus, if you make an infinitely configurable UI, power users will complain that they can't configure X and that is so obvious or worse an upgrade will wipe their settings and lose you a customer. So, long story short, only save the bare essentials that make the app usable. The rest, don't make configurable unless they ask.

          Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

          M K 2 Replies Last reply
          0
          • D DaveAuld

            Oh and another thing, your question reminded me of this conflict, Custom Application Configuration XML files Warning[^] Don't know if this has been resolved yet, haven't tried!

            Dave Find Me On: Web|Facebook|Twitter|LinkedIn


            Folding Stats: Team CodeProject

            M Offline
            M Offline
            Marc Clifton
            wrote on last edited by
            #14

            If you are making use of custom files to store config settings, don't call them AppName.config or AppName.exe.config. Oh my. That's good to know! Marc

            Latest Article: C# and Ruby Classes: A Deep Dive
            My Blog

            1 Reply Last reply
            0
            • RaviBeeR RaviBee

              I store settings and preferences (that can be safely recreated if missing) in an XML file.  I store application data that I don't want a user to be able to edit (and therefore corrupt) in a binary serialized Gzip'd file.

              Marc Clifton wrote:

              do you even save the user's preferences / state of the UI?

              Yes (as much as I can).  It's one of my personal criteria for a "polished" app. /ravi

              My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #15

              Ravi Bhavnani wrote:

              in a binary serialized Gzip'd file.

              Ah, snazzy. :) Marc

              Latest Article: C# and Ruby Classes: A Deep Dive
              My Blog

              1 Reply Last reply
              0
              • M Marc Clifton

                No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

                Latest Article: C# and Ruby Classes: A Deep Dive
                My Blog

                K Offline
                K Offline
                Klaus Werner Konrad
                wrote on last edited by
                #16

                All Settings are stored in the database, and even cascaded: factory (our) settings -> company settings -> user settings

                M 1 Reply Last reply
                0
                • N Nagy Vilmos

                  Dang Marc, have you been reading my hard drive again? I have a data class that contains named value pairs and supports String, Integer, Double, Date and Boolean values. These can be read from file in a simple format and used to persist state. The data class is also used for passing between services. It is my general throw around format. I need to work out an article for just this as I have 3-4 more that all use it so the DataSet becomes a pre-requisite article to write. One day...

                  Reality is an illusion caused by a lack of alcohol

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #17

                  Nagy Vilmos wrote:

                  Dang Marc, have you been reading my hard drive again?

                  Who, me? :~

                  Nagy Vilmos wrote:

                  I need to work out an article for just this

                  That would be great. The impetus, partly, for my survey'ish question is because I've been adding state/configuration persistence to an app, and I was wondering what sort of "best practices" there might be out there. The .NET class seems not configurable enough - I'd like to leave it open to the developer as to how to persist the state information. On the other hand, it also seems to closely coupled to "the Microsoft way", what with all the binding support, not that one needs to use it. At the moment, I've decided to go for an interface-less, more functional approach, resulting in this raw usage example:

                  public ApplicationFormController()
                  {
                  Program.AppState.Register("Form", () =>
                  {
                  return new List()
                  {
                  new State("X", View.Location.X),
                  new State("Y", View.Location.Y),
                  new State("W", View.Size.Width),
                  new State("H", View.Size.Height),
                  new State("WindowState", View.WindowState.ToString()),
                  };

                  	},
                  	state =>
                  	{
                  		// Silently handle exceptions for when we add state items that are part of the state file until we 
                  		// save the state.  This allows me to add new state information without crashing the app on startup.
                  		Program.Try(() => View.Location = new Point(state.Single(t => t.Key == "X").Value.to\_i(), state.Single(t => t.Key == "Y").Value.to\_i()));
                  		Program.Try(() => View.Size = new Size(state.Single(t => t.Key == "W").Value.to\_i(), state.Single(t => t.Key == "H").Value.to\_i()));
                  		Program.Try(() => View.WindowState = state.Single(t => t.Key == "WindowState").Value.ToEnum<FormWindowState>());
                  	});
                  

                  }

                  public override void EndInit()
                  {
                  Program.AppState.RestoreState("appState.xml");
                  }

                  Marc

                  Latest Article: C# and Ruby Classes: A Deep Dive
                  My Blog

                  F 1 Reply Last reply
                  0
                  • M Marc Clifton

                    No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

                    Latest Article: C# and Ruby Classes: A Deep Dive
                    My Blog

                    W Offline
                    W Offline
                    wizardzz
                    wrote on last edited by
                    #18

                    I used to use local xml when I did more UI programming. Database could be nice, but was never a requirement.

                    1 Reply Last reply
                    0
                    • K Klaus Werner Konrad

                      All Settings are stored in the database, and even cascaded: factory (our) settings -> company settings -> user settings

                      M Offline
                      M Offline
                      Marc Clifton
                      wrote on last edited by
                      #19

                      Klaus-Werner Konrad wrote:

                      factory (our) settings -> company settings -> user settings

                      Nice! Marc

                      Latest Article: C# and Ruby Classes: A Deep Dive
                      My Blog

                      K 1 Reply Last reply
                      0
                      • E Ennis Ray Lynch Jr

                        Back when I was a teenager, I thought saving UI State was all the rage but I soon gave it up. The massive amount of code required to store and manage it and make it all perfect just wasn't worth it. Heck, even today, I have a problem when I load firefox at home. You see I have a laptop hooked up to another monitor. However, that monitor is also wired to another machine. When the other machine is on, Windows on the laptop works fine but when I open something that was previously opened on the second monitor guess where it opens? If Windows and Firefox can't manage to get UI saving settings right why even bother? Plus, if you make an infinitely configurable UI, power users will complain that they can't configure X and that is so obvious or worse an upgrade will wipe their settings and lose you a customer. So, long story short, only save the bare essentials that make the app usable. The rest, don't make configurable unless they ask.

                        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

                        M Offline
                        M Offline
                        Marc Clifton
                        wrote on last edited by
                        #20

                        Ennis Ray Lynch, Jr. wrote:

                        If Windows and Firefox can't manage to get UI saving settings right why even bother?

                        Yes, that's one of the issues I think is important to deal with, as I've often had apps open areas that are no longer visible because I've removed a monitor. Marc

                        Latest Article: C# and Ruby Classes: A Deep Dive
                        My Blog

                        RaviBeeR 1 Reply Last reply
                        0
                        • M Marc Clifton

                          Nagy Vilmos wrote:

                          Dang Marc, have you been reading my hard drive again?

                          Who, me? :~

                          Nagy Vilmos wrote:

                          I need to work out an article for just this

                          That would be great. The impetus, partly, for my survey'ish question is because I've been adding state/configuration persistence to an app, and I was wondering what sort of "best practices" there might be out there. The .NET class seems not configurable enough - I'd like to leave it open to the developer as to how to persist the state information. On the other hand, it also seems to closely coupled to "the Microsoft way", what with all the binding support, not that one needs to use it. At the moment, I've decided to go for an interface-less, more functional approach, resulting in this raw usage example:

                          public ApplicationFormController()
                          {
                          Program.AppState.Register("Form", () =>
                          {
                          return new List()
                          {
                          new State("X", View.Location.X),
                          new State("Y", View.Location.Y),
                          new State("W", View.Size.Width),
                          new State("H", View.Size.Height),
                          new State("WindowState", View.WindowState.ToString()),
                          };

                          	},
                          	state =>
                          	{
                          		// Silently handle exceptions for when we add state items that are part of the state file until we 
                          		// save the state.  This allows me to add new state information without crashing the app on startup.
                          		Program.Try(() => View.Location = new Point(state.Single(t => t.Key == "X").Value.to\_i(), state.Single(t => t.Key == "Y").Value.to\_i()));
                          		Program.Try(() => View.Size = new Size(state.Single(t => t.Key == "W").Value.to\_i(), state.Single(t => t.Key == "H").Value.to\_i()));
                          		Program.Try(() => View.WindowState = state.Single(t => t.Key == "WindowState").Value.ToEnum<FormWindowState>());
                          	});
                          

                          }

                          public override void EndInit()
                          {
                          Program.AppState.RestoreState("appState.xml");
                          }

                          Marc

                          Latest Article: C# and Ruby Classes: A Deep Dive
                          My Blog

                          F Offline
                          F Offline
                          Forogar
                          wrote on last edited by
                          #21

                          Quote:

                          // Silently handle exceptions for when we add state items that aren't part of the state file until we

                          FTFY

                          - Life in the fast lane is only fun if you live in a country with no speed limits. - Of all the things I have lost, it is my mind that I miss the most. - I vaguely remember having a good memory...

                          M 1 Reply Last reply
                          0
                          • F Forogar

                            Quote:

                            // Silently handle exceptions for when we add state items that aren't part of the state file until we

                            FTFY

                            - Life in the fast lane is only fun if you live in a country with no speed limits. - Of all the things I have lost, it is my mind that I miss the most. - I vaguely remember having a good memory...

                            M Offline
                            M Offline
                            Marc Clifton
                            wrote on last edited by
                            #22

                            Forogar wrote:

                            FTFY

                            Why thank you! Correctness in comments is very important! Marc

                            Latest Article: C# and Ruby Classes: A Deep Dive
                            My Blog

                            1 Reply Last reply
                            0
                            • M Marc Clifton

                              No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

                              Latest Article: C# and Ruby Classes: A Deep Dive
                              My Blog

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #23

                              Marc Clifton wrote:

                              If you're a .NET developer, do you use ApplicationSettingsBase[^] ?

                              Yes, get's used from time to time; there's a wizard integrated into the IDE to manipulate the settings-file, it's defaults, and one can very easily bind to a property and forget about it.

                              Marc Clifton wrote:

                              if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ?

                              The apps state-information is not stored; only preferences, on user and application-scope (local and global). I've tried to save the complete state once (including undo/redo stack) and have the app restore to that state - it just confuses the users.

                              Marc Clifton wrote:

                              And yes, I'm talking about UI things, such as last window size and location

                              Hence the difference between "local" and "global" user-settings. Some things roam, others don't. The form-size doesn't roam, since my monitors have different sizes at different work-locations.

                              Marc Clifton wrote:

                              Same with, say, a tree control - what nodes were expanded and what nodes weren't?

                              No, not ever. How often do you need to be at that exact place in the tree? If very often, make a shortcut for the user. The reasoning is simlpe; you don't want to wait until the "Windows Explorer" loaded the entire tree, if you can simply click a hyperlink.

                              Marc Clifton wrote:

                              Plus things like "exit without asking" info, and so forth.

                              The question does not even exist. There's only a warning if something is dirty, but I'm not going to ask the user whether he knows what he/she is doing on every action.

                              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                              M 1 Reply Last reply
                              0
                              • M Marc Clifton

                                Klaus-Werner Konrad wrote:

                                factory (our) settings -> company settings -> user settings

                                Nice! Marc

                                Latest Article: C# and Ruby Classes: A Deep Dive
                                My Blog

                                K Offline
                                K Offline
                                Klaus Werner Konrad
                                wrote on last edited by
                                #24

                                Thanks ! I should add, there is a Y/N field in the table that says 'station specific', so I can use one table for user AND station dependant settings, such as directories.

                                1 Reply Last reply
                                0
                                • M Marc Clifton

                                  No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

                                  Latest Article: C# and Ruby Classes: A Deep Dive
                                  My Blog

                                  S Offline
                                  S Offline
                                  S Houghtelin
                                  wrote on last edited by
                                  #25
                                  this.WindowState = FormWindowState.Maximized;
                                  this.MinimumSize = this.Size;
                                  this.MaximumSize = this.Size;
                                  

                                  Generally I use the an application config file for persistant settings.

                                  It was broke, so I fixed it.

                                  1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

                                    Latest Article: C# and Ruby Classes: A Deep Dive
                                    My Blog

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #26

                                    Users? What are those? I use XML: XmlNode[^]

                                    1 Reply Last reply
                                    0
                                    • L Lost User

                                      Marc Clifton wrote:

                                      If you're a .NET developer, do you use ApplicationSettingsBase[^] ?

                                      Yes, get's used from time to time; there's a wizard integrated into the IDE to manipulate the settings-file, it's defaults, and one can very easily bind to a property and forget about it.

                                      Marc Clifton wrote:

                                      if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ?

                                      The apps state-information is not stored; only preferences, on user and application-scope (local and global). I've tried to save the complete state once (including undo/redo stack) and have the app restore to that state - it just confuses the users.

                                      Marc Clifton wrote:

                                      And yes, I'm talking about UI things, such as last window size and location

                                      Hence the difference between "local" and "global" user-settings. Some things roam, others don't. The form-size doesn't roam, since my monitors have different sizes at different work-locations.

                                      Marc Clifton wrote:

                                      Same with, say, a tree control - what nodes were expanded and what nodes weren't?

                                      No, not ever. How often do you need to be at that exact place in the tree? If very often, make a shortcut for the user. The reasoning is simlpe; you don't want to wait until the "Windows Explorer" loaded the entire tree, if you can simply click a hyperlink.

                                      Marc Clifton wrote:

                                      Plus things like "exit without asking" info, and so forth.

                                      The question does not even exist. There's only a warning if something is dirty, but I'm not going to ask the user whether he knows what he/she is doing on every action.

                                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                                      M Offline
                                      M Offline
                                      Marc Clifton
                                      wrote on last edited by
                                      #27

                                      Eddy Vluggen wrote:

                                      you don't want to wait until the "Windows Explorer" loaded the entire tree,

                                      I meant trees like, "to do" lists or some other hierarchical information.

                                      Eddy Vluggen wrote:

                                      on user and application-scope (local and global)

                                      That makes sense. Marc

                                      Latest Article: C# and Ruby Classes: A Deep Dive
                                      My Blog

                                      1 Reply Last reply
                                      0
                                      • M Marc Clifton

                                        Ennis Ray Lynch, Jr. wrote:

                                        If Windows and Firefox can't manage to get UI saving settings right why even bother?

                                        Yes, that's one of the issues I think is important to deal with, as I've often had apps open areas that are no longer visible because I've removed a monitor. Marc

                                        Latest Article: C# and Ruby Classes: A Deep Dive
                                        My Blog

                                        RaviBeeR Offline
                                        RaviBeeR Offline
                                        RaviBee
                                        wrote on last edited by
                                        #28

                                        IMHO, this is a generic problem: i.e. restoring potentially invalid state.  Whenever I restore state (almost always from an editable XML file), my code validates and auto-corrects the data being read.  Other examples of this are selecting a tree node that may no longer exist, etc.  The bottom line is, it's the developer's responsibility to handle all possible use cases. All this takes additional work and time.  And your users will love you for it. /ravi

                                        My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                                        1 Reply Last reply
                                        0
                                        • M Marc Clifton

                                          No, not a programming question, and no, not a "recover from a Friday drinking binge" question. Just curious, what different techniques people use (specifically for WinForm apps). Do you roll your own persistence class? If you're a .NET developer, do you use ApplicationSettingsBase[^] ? I'm also curious, if you develop client/server apps, if you store your app's state information locally or in a database so that your user can use any client machine and the UI is configured to their preferences ? And yes, I'm talking about UI things, such as last window size and location, but also more interesting things such as what columns the user selected to be visible on a grid, what display order, what sort order, etc. Same with, say, a tree control - what nodes were expanded and what nodes weren't? Plus things like "exit without asking" info, and so forth. Heck, do you even save the user's preferences / state of the UI? Marc

                                          Latest Article: C# and Ruby Classes: A Deep Dive
                                          My Blog

                                          B Offline
                                          B Offline
                                          BobJanova
                                          wrote on last edited by
                                          #29

                                          I typically save a file in the working directory, which allows the user to set up different shortcuts with different preferences if they want, and it makes the app portable as nothing is stored in system folders (or the registry etc) so you can put it on a USB stick. I put default configuration settings into the app as a resource so I can use the same reader to load it.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups