Click here to Skip to main content
13,593,789 members
Rate this:
Please Sign up or sign in to 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 22-Jan-13 5:06am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

What it means according to Microsoft is:
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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.180618.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100