|
-
Jul 9th, 2009, 10:58 AM
#1
Thread Starter
Member
[RESOLVED] Can not saving app's settings
-
Jul 9th, 2009, 12:06 PM
#2
Addicted Member
Re: Can not saving app's settings
 Originally Posted by canavaroski90
Hi all,
I've a project called G.S.S. There's a 2 forms in the G.S.S and a checkbox on the form2. I added these codes:
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.CheckBox4.Checked = My.Settings.chk
End Sub
AND
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.chk = Form2.CheckBox4.Checked
End Sub
But it's not working
Then I created an another example project to try these on, added 2 forms, a checkbox on form2 and wrote same codes. I wondered when I run the app because it's running perfect. It saves the settings
So what's wrong with my G.S.S project? 
(Sorry because of my terrible English  )
With checkboxes why don't you just bind the 'checked' property of the control to a my.settings value?
I'm having a similar problem to you with radio buttons (because they mess up if you bind them).. but my bound checkboxes save fine.
-
Jul 9th, 2009, 01:05 PM
#3
Re: Can not saving app's settings
Check that in your project properties you have the box ticked that says "Save Settings On Exit" or something like that.
If you dont want that setting turned on for whatever reason then you can always just manually call My.Settings.Save()
-
Jul 9th, 2009, 01:28 PM
#4
Thread Starter
Member
Re: Can not saving app's settings
To "chris128"; I tried this method but it's stilll not working.
And 4xzer0, can you explain your suggestion in more detailed way?
-
Jul 9th, 2009, 01:40 PM
#5
Re: Can not saving app's settings
Did you check that the option named "Save My.Settings on Shutdown" is enabled in your project as I mentioned?
Also, your Chk setting is of type Boolean isnt it?
EDIT: just noticed that your checkbox is actually on Form2, so why are you setting and saving it in Form1's events?
-
Jul 9th, 2009, 01:43 PM
#6
Thread Starter
Member
Re: Can not saving app's settings
Ok, I resolved the problem thx for helps.. But I want to write the solution; I was writing the codes in form1 load and form1.closing sections, but I wasn't using X button to close form1. I think this was the source of the problem, I was using my own close button. I changed the codes position, wrote them in form2.load and in the button which hides form2. So, It's working
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|