Click here to Skip to main content
11,806,590 members (45,172 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MFC VisualC++
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
0 ppolymorphe 295
1 OriginalGriff 150
2 George Jonsson 135
3 Richard Deeming 120
4 CPallini 100
0 OriginalGriff 3,380
1 Maciej Los 1,990
2 CPallini 1,915
3 KrunalRohit 1,907
4 ppolymorphe 1,317

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

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