Below is the code in VB. I want GetSetting + SaveSetting in VB.Net---

Call SaveSetting(App.ProductName, App.title, "CheckBox1", values)

call CheckBox1.value=GetSetting(App.Productname,App.title,"CheckBox1",VbUnChecked)


Call SaveSetting(Application.ProductName, Application.ProductName, "CheckBox1", values)
Abive SaveSetting is rite or not???
Secomdly. what is the code gor GetSetting???

Recommended Answers

All 3 Replies

Get Setting:

MySettingValue = My.Settings.Default.SettingName

Save Setting:

My.Settings.Default.SettingName = ConnString

I dont thnik so dat ur reply does dat which i want..

Please work on your spelling :) It will make things a lot easier to understand.

Note that you don't have to use "Call" every time in VB.NET. Secondly, you aren't using the function right.

Say, on form closing, you want it to save the value of the check box and on next start you want it to retain its value. You would do this.

I wrote this code from the top of my head- I don't know if it works or not. I'm in a bit of a hurry, so I can't check if it works.

Private Sub Form1_Closing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.FormClosing
    ' Save the checkbox's value to the registry
    SaveSetting(Application.ProductName, Application.ProductName, "CheckBox1", CheckBox1.Checked)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Get checkbox value
    CheckBox1.Checked = GetSetting(Application.ProductName, Application.ProductName, "CheckBox1")
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.