'Create a setting called 'cb1'
'(Double click on the solution explorer window, 'My project')
'Find the 'settings' tab.
'Name = cb1, Type = Boolean, Scope = user, Value = False
'On a form with 2 buttons:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' chk the box
Me.CheckBox1.Checked = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' unchk the box
Me.CheckBox1.Checked = False
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.cb1 = Me.CheckBox1.Checked
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.CheckBox1.Checked = My.Settings.cb1
End Sub
End Class
|