Results 1 to 12 of 12
  1. #1
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108

    [Tutorial]Saving Checkbox True/False Statement

    Well, credits probably go to Nextge1n for telling me =D

    So basiclly what this does is the following:

    It saves your "decession" whether you picked False/True.

    If the usual value is false and you start your program and set it to true and restart your program, the checkbox will still be checked.

    This saves a lot of time. I was actually about to do it way more complicated ->

    Code:
    Dim box as string
    
    if checkbox1.checked = true
    box = 1
    Saving this into an .ini...

    On form load...

    Loading the .ini settings...

    ->
    Code:
    if box = 1 then
    checkbox1.checked
    else
    checkbox.checked = false
    Forget about my SHITTY idea!

    Let's start

    1. Go to your form properties(Project-Explorer -> Righ***ick on your project -> Properties)



    2. Go to Settings

    3. Change the Name "Settings" to "Checked" or whatever you want it to be.
    Let's name it "Checked1337."

    Hit enter.



    Here comes the code...

    On Checkbox1.checked event:

    Code:
    If checkbox1.checked = true Then
    My.Settings.Checked1337 = "True"
    else 
    my.settings.checked1337 = "False"
    end if
    My.Settings.save
    You might also use "1" instead of True or whatever you like..

    On Form Load:

    Code:
    If My.settings.Checked1337 = "True" Then
    checkbox1.checked = true
    else
    checkbox1.checked = false
    end if
    It should look like this:

    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If My.Settings.Checked1337 = "True" Then
                CheckBox1.Checked = True
            Else
                CheckBox1.Checked = False
            End If
        End Sub
    
      
        Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
            If CheckBox1.Checked Then
                My.Settings.Checked1337 = "True"
            Else
                My.Settings.Checked1337 = "False"
            End If
            My.Settings.Save()
    
        End Sub
    End Class
    This tutorial is very noob-friendly

    Everyone should be able to understand it.

    Thanks to nextgen1.

    I didn't check if the code works, it should anyways.

    Written by: Meh
    Special Thanks to: Nextgen1 AGAIN for explaining me <3



  2. The Following 2 Users Say Thank You to Blubb1337 For This Useful Post:

    NextGen1 (02-04-2010),XGelite (02-04-2010)

  3. #2
    XGelite's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Enter text here
    Posts
    1,344
    Reputation
    12
    Thanks
    276
    mmmmmk.. .

  4. #3
    Zoom's Avatar
    Join Date
    May 2009
    Gender
    male
    Location
    Your going on my 24/7 DDoS hit list.
    Posts
    8,552
    Reputation
    127
    Thanks
    5,970
    My Mood
    Happy
    Good for the beginners!
    -Rest in peace leechers-

    Your PM box is 100% full.

  5. #4
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Good Job Posting it,


     


     


     



    The Most complete application MPGH will ever offer - 68%




  6. #5
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    BASIC BASIC BASIC!!!
    oh, and u can use my.settings...


    -----------------------------------------------

    My site: here
    My Blog: here
    My member's area: here
    Minecraft Sever Forum: here


    Minecraft Servers:

    Public:



    Private:



  7. #6
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    What is this?

    Meh thanks for the post I guess.

    This section needs more activity IMO.

  8. The Following User Says Thank You to Lolland For This Useful Post:

    NextGen1 (02-04-2010)

  9. #7
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    This section needs more activity IMO.
    I agree. Sending you a Pm on somethings soon


     


     


     



    The Most complete application MPGH will ever offer - 68%




  10. #8
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused
    Ehhh Good Job?

  11. #9
    hopefordope's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Herndon,VA
    Posts
    264
    Reputation
    9
    Thanks
    86
    My Mood
    Psychedelic
    hey does this work for a textbox

    Press Thank You[IMG]https://i45.tinypic.com/2hg8w0n.jpghttps://img1.UploadScreensho*****m/images/main/2/3203234450.jpg[/IMG]










    My Releases
    Injector 3G
    Injector 2G
    Injector 1G
    Super Spammer
    CA Cleaner
    My Tutorials
    How to Make a real Injector(PerX)
    How to Make a Calculator(leeched)

  12. #10
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Sorry, Lag had me double post.
    Last edited by NextGen1; 02-05-2010 at 02:50 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  13. #11
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Use

    Use this on form close , or button, or on text1_changed
    IO.File.WriteAllText("File Location to save + Filename.Extension", TextBox1.Text)


    Use this in form load

    TextBox1.Text = IO.File.ReadAllText("FileLocation/File.extension)


     


     


     



    The Most complete application MPGH will ever offer - 68%




  14. #12
    MugNuf's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Posts
    790
    Reputation
    9
    Thanks
    160
    My Mood
    Goofy
    Quote Originally Posted by hopefordope View Post
    hey does this work for a textbox
    If you saying that i think you want then yes.

    On form_load put this:

    [php]If My.Settings.Checked1337 = "True" Then
    CheckBox1.Checked = True
    TextBox1.Text = "your text here"[/php]

    Simple, that will load the textbox's text every time you load it .

Similar Threads

  1. [Help] My.Settings to save checkboxes [solved]
    By Cryptonic in forum Visual Basic Programming
    Replies: 7
    Last Post: 03-27-2011, 06:50 PM
  2. [Tutorial]Saving/Loading a Listbox Contents
    By Bombsaway707 in forum Visual Basic Programming
    Replies: 13
    Last Post: 02-26-2010, 03:57 PM
  3. [Help] MAKING A CHECKBOX TO SAVE LOGIN
    By Dreamer in forum Visual Basic Programming
    Replies: 16
    Last Post: 01-18-2010, 07:55 AM
  4. [HELP] How do u save settings and check all checkboxes at once?
    By deathninjak0 in forum Visual Basic Programming
    Replies: 15
    Last Post: 11-18-2009, 03:02 PM
  5. [Tutorial] VB Checkboxes/Superjump/Pointers/Password Protection
    By mains3rv3r in forum WarRock - International Hacks
    Replies: 26
    Last Post: 06-29-2007, 01:17 AM