<Serializable()> Public Structure ControlsInfo
Public textbox1text As String
Public radiobutton1checked As Boolean
Public radiobutton2checked As Boolean
Public savebuttonenabled As Boolean
'etc
End Structure
Sub SaveInfo()
Dim ci As New ControlsInfo
ci.textbox1text = Me.TextBox1.Text
ci.radiobutton1checked = Me.RadioButton1.Checked
ci.radiobutton2checked = Me.RadioButton2.Checked
ci.savebuttonenabled = Me.SaveButton.Enabled
Dim filename As String = IO.Path.Combine(Application.StartupPath, "ControlsInfo.xml")
Using fs As New IO.FileStream(filename, IO.FileMode.Create, IO.FileAccess.Write)
Dim ser As New Xml.Serialization.XmlSerializer(GetType(ControlsInfo))
ser.Serialize(fs, ci)
End Using
End Sub
Sub LoadInfo()
Dim ci As ControlsInfo
Dim filename As String = IO.Path.Combine(Application.StartupPath, "ControlsInfo.xml")
Using fs As New IO.FileStream(filename, IO.FileMode.Open, IO.FileAccess.Read)
Dim ser As New Xml.Serialization.XmlSerializer(GetType(ControlsInfo))
ci = ser.Deserialize(fs)
End Using
Me.TextBox1.Text = ci.textbox1text
Me.RadioButton1.Checked = ci.radiobutton1checked
Me.RadioButton2.Checked = ci.radiobutton2checked
Me.SaveButton.Enabled = ci.savebuttonenabled
End Sub