Results 1 to 8 of 8
  1. #1
    Cryptonic's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    United Provinces of Canada
    Posts
    1,313
    Reputation
    44
    Thanks
    190
    My Mood
    Bored

    [Help] My.Settings to save checkboxes [solved]

    Ok, so im trying to save 2 check boxes.

    On click/formclosing

    Code:
    If CheckBox1.Checked = True Then
                My.Settings.check1 = CheckBox1.Checked = True
            Else
                My.Settings.check1 = CheckBox1.Checked = False
            End If
            If CheckBox2.Checked = True Then
                My.Settings.check2 = CheckBox2.Checked = True
            Else
                My.Settings.check2 = CheckBox2.Checked = False
            End If
            My.Settings.Save()
    On load

    Code:
            CheckBox1.Checked = My.Settings.check1
            CheckBox2.Checked = My.Settings.check2
    When it loads, both of them are always checked...

  2. #2
    edub18's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Germany
    Posts
    146
    Reputation
    10
    Thanks
    12
    My Mood
    Bored
    Code:
    My.Settings.check1 = CheckBox1.Checked = True
    Whats that? O.ô 2x = in 1 line?

  3. #3
    Cryptonic's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    United Provinces of Canada
    Posts
    1,313
    Reputation
    44
    Thanks
    190
    My Mood
    Bored
    Quote Originally Posted by Vanoq View Post
    Code:
    My.Settings.check1 = CheckBox1.Checked = True
    Whats that? O.ô 2x = in 1 line?
    What do you mean? One is False, One is True

  4. #4
    T0P-CENT's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    88
    Reputation
    14
    Thanks
    17
    My Mood
    Stressed
    Put on Form Close event
    Code:
    If CheckBox1.Checked = True Then
    My.Settings.check1 = True
    Else
    My.Settings.check1 = False
    End If
    ''' this was for checkbox 1 now for checkbox2
    If CheckBox2.Checked = True Then
    My.Settings.check2 = True
    Else
    My.Settings.check2 = False
    End If
    should work make sure u maked the settings type to boolean and the value set to false

  5. #5
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Or just put on the CheckChanged event of each CheckBox:

    [highlight=vb.net]
    My.Settings.check1 = CheckBox1.Checked
    My.Settings.check2 = CheckBox2.Checked
    My.Settings.Save()
    My.Settings.Reload()
    [/highlight]

    Then on the form load do what you're already doing.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  6. The Following User Says Thank You to Jason For This Useful Post:

    Cryptonic (03-27-2011)

  7. #6
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    https://www.mpgh.net/forum/33-visual-...ml#post2724971

    I am sure you can edit it slightly to fit to your needs.
    Last edited by Hassan; 03-27-2011 at 12:13 AM.

  8. #7
    Cryptonic's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    United Provinces of Canada
    Posts
    1,313
    Reputation
    44
    Thanks
    190
    My Mood
    Bored
    Quote Originally Posted by Jason View Post
    Or just put on the CheckChanged event of each CheckBox:

    [highlight=vb.net]
    My.Settings.check1 = CheckBox1.Checked
    My.Settings.check2 = CheckBox2.Checked
    My.Settings.Save()
    My.Settings.Reload()
    [/highlight]

    Then on the form load do what you're already doing.
    Yeah, thats what I figured out... I didnt use Reload though

  9. #8
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by ************* View Post


    Yeah, thats what I figured out... I didnt use Reload though
    Reload isn't actually necessary, it just resets all settings to their last-saved state. It'd probably work without them.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  10. The Following User Says Thank You to Jason For This Useful Post:

    JulianProHG (06-02-2018)