Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi..How I can save report style listcontrol in a text file and retrive it later.

In listcontrol some columns set as edit boxses and some columns set as comboboxses.

How i can access the listcontrol element and archive that element to load later.

any help, comment, suggestions are appriciated..Thanks.
Posted

1 solution

To make it truly MFC you would need to make your listcontrol serializable[^].

What it means according to Microsoft is:
Quote:
Serialization is the process of writing or reading an object to or from a persistent storage medium such as a disk file. Serialization is ideal for situations where it is desired to maintain the state of structured data (such as C++ classes or structures) during or after execution of a program. Using the serialization objects provided by MFC allows this to occur in a standard and consistent manner, relieving the user from the need to perform file operations by hand.


Making the object serializable is a very simple process (see the link above). However, you would have to define << and >> operators to read to/fro CArchive. Here, where you will have to define the document structure.

First thing that comes to mind is to use a comma-separated file CSV[^]. By doing it this way you also provide an ability to the users to open and view the files via Excel.

However, if you have values in your listcontrol with commas or line breaks, the values would have to be quoted. See here[^] for more details
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900