views:

940

answers:

2

Good evening,

I have set in the AppSettings of my project a ListView object but I have no idea what I should use as value?! Because when I left it blank I can't save anything to my setting property rather the get value is always null after save. Is it possible to do this with AppSettings actually ?

Thanks for your answers!

Kind regards

A: 

How do you save your listview, could you provide some code? If you want to persist the state of your listview, you could try the XMLSerializer or the SoapFormatter to generate the xml and store it in a separate xml file.

driAn
The problem was that a ListView is not serializable. So I fill all the ListViewItems in my "MyEntry"-class and put these in a List<MyEntry> and save this list through BinaryFormatter (Look at SoapFormatter) =).
Fabian
ah ok, didn't know that.
driAn
Yeah no problem! The programm is running great with BinaryFormatter now ;-) ! Thanks a lot!
Fabian
A: 

I have set in the project properties at the settings section:

Name: aListView Type:

System: Windows.Forms.ListView Scrope:

User Value:

I belive I should set something to value but i don't know what. Because when I left it blank and I save my settings like:

Settings mySettings = new Settings();
mySettings.aListView= this.myListView;
mySettings.Save();

There is nothing in the settings file of my user directory. I have also tried to initialize aListView with:

mySettings.alistView = new ListView();

Or add Items to aListView, but nothing works... :)

Fabian