Save a ListView into Settings.settings?

581 Views Asked by At

How can I save a ListView with multicolumns into Settings.settings and load them upon running? I'm trying to save a ListView with 3 columns. How can I do that?

1

There are 1 best solutions below

3
On BEST ANSWER
  1. Bind the listview to some data structure.
  2. Serialize is using xmlseriualizer - then you can save the result into the Settings.

Restoring is done using deserialize.

StringWriter output = new StringWriter(new StringBuilder());
XmlSerializer s = new XmlSerializer(this.GetType());
s.Serialize(output,this);
var result = output.ToString()