Well, credits probably go to Nextge1n for telling me =D
So basiclly what this does is the following:
It saves your "decession" whether you picked False/True.
If the usual value is false and you start your program and set it to true and restart your program, the checkbox will still be checked.
This saves a lot of time. I was actually about to do it way more complicated ->
Code:
Dim box as string
if checkbox1.checked = true
box = 1
Saving this into an .ini...
On form load...
Loading the .ini settings...
->
Code:
if box = 1 then
checkbox1.checked
else
checkbox.checked = false
Forget about my SHITTY idea!
Let's start
1. Go to your form properties(Project-Explorer -> Righ***ick on your project -> Properties)
2. Go to Settings
3. Change the Name "Settings" to "Checked" or whatever you want it to be.
Let's name it "Checked1337."
Hit enter.
Here comes the code...
On Checkbox1.checked event:
Code:
If checkbox1.checked = true Then
My.Settings.Checked1337 = "True"
else
my.settings.checked1337 = "False"
end if
My.Settings.save
You might also use "1" instead of True or whatever you like..
On Form Load:
Code:
If My.settings.Checked1337 = "True" Then
checkbox1.checked = true
else
checkbox1.checked = false
end if
It should look like this:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Settings.Checked1337 = "True" Then
CheckBox1.Checked = True
Else
CheckBox1.Checked = False
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
My.Settings.Checked1337 = "True"
Else
My.Settings.Checked1337 = "False"
End If
My.Settings.Save()
End Sub
End Class
This tutorial is very noob-friendly
Everyone should be able to understand it.
Thanks to nextgen1.
I didn't check if the code works, it should anyways.
Written by: Meh
Special Thanks to: Nextgen1 AGAIN for explaining me <3