I have a checked list box that I want to check off a few items and then close that form. However, when I go back to the form with the check list box, I want to be able to see those same items that I checked off earlier....thus, I need to save those checks somehow.
C# How can I save checked boxes in a checked list box?
Store the value of the checked box to a XML file or simple INI file and then on form load check the boxes accordingly.
Reply:If you have an Instance of that form (an object) which you use throughout the application, you shouldn't be having a problem. If you declare it as a class-member so its the exact same instance being used each time, the values ought to be retained.
If however, you're creating a new Instance of type 'Form' each time (like a local variable), then then you'll need to somehow save the information. Either an XML or INI file (if you want to restore them even after you exit the application and open it again), or store it in memory, like a string or an integer using bit-shifting (yeah, you can still do bit-shifting in C#).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment