Click here to Skip to main content
15,891,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
is there anyway that I can save the item in the `Listview` into a text file?? For example..

col.1| col.2| col3.| col.4| col.5
---------------------------------
Data | Data | Data | Data | Data 
Data | Data | Data | Data | Data
Posted
Updated 18-Jan-15 1:20am
v2
Comments
Richard MacCutchan 18-Jan-15 7:21am    
Yes, write some code that takes the data from each row and writes it to a file. But exactly how you do that will largely depend on what the data is and how you want it to be formatted in the file.
_Asif_ 19-Jan-15 2:47am    
What have you tried so far?
[no name] 19-Jan-15 3:18am    
Do you want to save all the rows and columns and what do you plan to use the text file for?
Member 11383125 19-Jan-15 8:54am    
Yes, I do. I would separate the supposed listview to the two lists and again display as two listviews.

Writing the data in a text file should be really no problem, but you must write the data in a format to read it out. If it is all text, you can separate the item data with a newline "\n".

When you write the storing code you should also write the reading code. And write some test code to verify your solution ;-)

An "old school" solution would be ini-files with WritePrivateProfileString. Each item would be a numbered section.
 
Share this answer
 
You may also consider object serialization (just Googling, you may find tutorials and sample code on the web).
 
Share this answer
 
One option is to export listview to csv file and read back from there. csv is widely used and you can split the data items as you wish.

Google "export/import listview to csv."

Start here https://code.msdn.microsoft.com/windowsdesktop/export-ListView-to-CSV-39cd5f72[^]
 
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