Hi All,

I have the following Code ...

<Serializable()> Public Structure sLV
Public lvi As ListViewItem
End Structure

Dim LV As sLV
Dim rLV As sLV
Dim LI as ListViewItem


I have a Single Listview on the Form : ListView1 in Details Mode and Checkmarks Enabled

Public Sub MakeLV
ListView1.Clear()
ListView1.CheckBoxes = True
ListView1.Columns.Add("ONE", ListView1.Width)
Dim LI As New ListViewItem()
LI.Checked = True
LV.lvi = LI.Clone
ListView1.Items.Add(LI)
End Sub

The code Loads the ListView and Structure with a DATA Item

Save Function

Public Sub SystemSave(ByVal strFname As String)
' Save the Object to a DISK File
Dim myFS As Stream = File.Create(strFname) ' Open File Stream
Dim serializer As New BinaryFormatter() ' Create Serializer
serializer.Serialize(myFS, LV) ' Serialize the Object
myFS.Close()
End Sub

' Restore Function

Public Sub SystemRestore(ByVal strFname As String)
' Restore Object from Disk File
Dim myFS As Stream = File.OpenRead(strFname) ' Open File Stream
Dim deserializer As New BinaryFormatter()
rLV = CType(deserializer.Deserialize(myFS), sLV)
myFS.Close()
End Sub

Now I Serialize the Structure and Store to Disk, Then Retreive the Structure and try to Restore the Item in the ListView


Public Sub RestoreLV
ListView1.Clear()
ListView1.CheckBoxes = True
ListView1.Columns.Add("ONE", ListView1.Width)
Dim LI As New ListViewItem()
LI = rLV.lvi.Clone
ListView1.Items.Add(LI)
End Sub


It does restore the Item BUT NOT the CheckMark if it was checked ? Does anybody know why this would happen ?

Nick