-
[RESOLVED] My.Settings
I am not sure what the heck I am doing wrong. I would like if when the user selects no, then the app setting is nothing. By nothing I mean nothing, I am using "Nothing" to test but its not working it returns whatever is in the richtextbox
This is in my formclosing event
Code:
Dim msg As String = "Do you want to save your comments?"
MessageBox.Show(msg, "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If DialogResult = Windows.Forms.DialogResult.Yes Then
My.Settings.Comments = Me.RichTextBox1.Text
My.Settings.Save()
ElseIf DialogResult = Windows.Forms.DialogResult.No Then
My.Settings.Comments = "Nothing"
My.Settings.Save()
End If
-
Re: My.Settings
You have not specified DialogResult... DialogResult is the forms dialogResult in this case... NOT the dialogResult of your message box...
Try this:
Code:
Dim msg As String = "Do you want to save your comments?"
Dim result = MessageBox.Show(msg, "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = Windows.Forms.DialogResult.Yes Then
My.Settings.Comments = Me.RichTextBox1.Text
My.Settings.Save()
Else
My.Settings.Comments = "Nothing"
My.Settings.Save()
End If
Kris
-
Re: My.Settings
oh geez.... thanks I new I was missing something
Thank you :)