Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC VC++
Hi,
Need help..Can I save this List control and retrive it later ? so that i don't have to enter all values again in editable column and in combobox column.
 
Thanks in advance.
Posted 19-Nov-12 5:29am

1 solution

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

Solution 2

There are a lot of examples of how to do this on the web. Basically, you need two functions: one that serializes the current contents of the control to an XML file, and one that loads the control by deserializing the file. You can do this either with separate methods that take the control as a parameter or by subclassing the control.
 
It is a common technique, so there are lots of examples on the web, better than I could offer in a quick answer. It's pretty straightforward, but does require a bit of knowledge about XML and how to read and write XML files.
  Permalink  
Comments
peoria123 at 19-Nov-12 15:48pm
   
Thank you for your reply. I don't know how to read and write file in xml. I am working in vc++ mfc dialogbased application. is serialization is good method for dialogbased application? any alternative method (like get ,set current value)??
(dialog box has 2 tabs ..List control with editable columns and combobox columns on each tab)
 
Thank you.
Gregory.Gadow at 19-Nov-12 15:58pm
   
XML (eXtensible Mark-up Language) is just a text file that follows specific rules. It is very flexible; there were a few versions of Excel that used XML to store spreadsheets. A full tutorial would be well beyond what can be given as a quick answer, I'm afraid: you will have to do some research to find a solution that works best for you. As for "serialize" and "deserialize", those are just fancy words that mean "convert to and from a text format that can be moved between different types of data structures" including files.
peoria123 at 20-Nov-12 12:25pm
   
Hi Gregory,
Thank you for your reply.
I searched on google about XML file but I don't know which example is appropriate for me.can you please send me a link which will help me or guide me. Is there any other option to save the listcontrol?
Thank you.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 474
1 Maciej Los 375
2 OriginalGriff 263
3 CPallini 214
4 Peter Leow 200
0 OriginalGriff 6,152
1 Sergey Alexandrovich Kryukov 5,312
2 Maciej Los 3,279
3 Peter Leow 3,184
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
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