Results 1 to 3 of 3

Thread: [RESOLVED] My.Settings

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Resolved [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

  2. #2
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    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

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: My.Settings

    oh geez.... thanks I new I was missing something

    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width