Note : All Colors In Plain Text Refers to the Last Photo.
1. > Create a Project
2. > Click on Project (In the Toolstrip) and Select Application Properties
3. > Click on Settings
4. >> Settings Brief Explanation
Purple Arrow : The Purple Arrow is Pointing to the Variable name. For Example in this case it would be like typing
Dim Setting. Except the Varibles Stay with in the application no matter if it closes or not.
Orange Arrow : The Orange Arrow is Pointing to the Variable type. Such as String , Integer , Etc
Blue Arrow : The Blue Arrow is Pointing to the Value which should match the type.
So if we wanted to convert a normal variable into one that saves it would be like this..
Dim
Setting As
String
Setting =
"" (Value Considering theres nothing there).
Using Settings Out of Properties
Now that you set your setting you will have to know how to use it...
When you want a value saved as the setting you would type..
My.Setting.
Setting = "
Test"
My.Setting.Save()
Code Examples
1. > Saving a Textbox1's Date and Setting it to Load on Form Open.
Code:
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.FormClosing
My.Settings.Setting = TextBox1.Text
My.Settings.Save()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = My.Settings.Setting
End Sub
End Class
2. > Saving a Checkbox's Status
Code:
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.FormClosing
My.Settings.Setting = CheckBox1.CheckState
My.Settings.Save()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckBox1.CheckState = My.Settings.Setting
End Sub
End Class
Note : If you have any questions feel free to reply...if not reply anyway! lol