Click here to Skip to main content
12,069,857 members (65,538 online)
Rate this:
 
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 6:06am

1 solution

Rate this: bad
 
good
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:
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
  Permalink  

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 | Mobile
Web03 | 2.8.160208.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2016
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