Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed

    [tut]My.Settings[Article]

    My.Settings Tutorial
    A few threads have been created about using settings, so here is a quick article/tutorial to help.In all honesty, the checkbox on and off setting is just more extensive and unneeded, this method will look more professional and clean (IMO)

    What is it and what is it used for?

    My.Settings is used as a way to distinguish between all the different user/application settings, So instead of hardcoding information and settings you can allow the user to set settings and change them.

    To define or modify the users settings

    Right Click the application name in the solution explorer , Click properties

    Now Select the settings tab on the left side. It may (or should) say no settings have been defined.




    • Click the setting element in the table.


    • Create a Unigue Name for the setting


    • Use the combobox to choose the data type of the setting.

    (Note: Default is set to string)

    • Under Scope, select whether the setting should have User or Application scope


    (Note: The difference between user and application settings is application scope are read only at run time, user scope are read/write at run time, so depending on your needs this should be modified)

    • you should always set a default value


    at the top of the settings window you will notice ther are two commands

    Synchronize: Returns all settings to the values that were determined in the settings window.

    View Code: opens the MySettings class , you can use this to define setting releated events in this window.

    How do you use your settings?

    In your program, settings are automatically available to your code using the syntax My.Settings.GivenNameOfSetting

    Lets look at a example:

    [php]
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

    Dim CVal As String = My.Settings.ExitM
    MessageBox.Show("The Value of ExitM is " & CVal & "'")
    End Sub
    [/php]

    The above code will allow you to view the setting of ExitM as a string.

    You can choose any type you like, in my case I prefer Boolean and set the value to true or false, as it has a similar effect to using a checkbox, just looks more professional.

    Note: changes you make to a user setting (or set of) are automatically saved when the program shuts down, so there is no need to have a save button , however If you want to save them on a button click or similiar all you have to do is call

    [php]
    My.Settings.Save
    [/php]

    You can reload your saved settings using

    [php]
    My.Settings.Reload
    [/php]


    Accessing and allowing user to change settings with
    extreme ease.



    First thing you need to do is add a "PropertyGrid" to your form.




    Add the following code to the form load event

    [php]
    PropertyGrid1.SelectedObject = My.Settings
    [/php]

    This grid will display both user and application settings in the form. (application settings will not be editable)

    If you would like the grid to only display user settings, place this code right after the above code

    [php]
    Dim uat As New System.Configuration.UserScopedSettingAttribute
    Dim atts As New System.ComponentModel.AttributeCollection(uat)
    PropertyGrid1.BrowsableAttributes = atts
    [/php]

    This will allow the user to easily access the user settings and change the values.



    after a change you can use boolean (true or false) to handle an action

    Then whenever you want you can check the value of a setting with

    [php]
    If my.settings.settingname = true then ' or a value 'if not boolean
    'yada yada yada yada
    else
    end if
    [/php]

    Hope this helps with the settings questions that have been asked in this section over and over :p

    Uploading a few images , one sec.
    Last edited by NextGen1; 03-24-2010 at 03:10 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




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

    MJLover (03-24-2010),ppl2pass (03-24-2010),Zoom (03-25-2010)

  3. #2
    ppl2pass's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    804
    Reputation
    5
    Thanks
    111
    My Mood
    Amused
    nice tutorial. very helpful. but can you also help me with the gct file convertor. thanks.

  4. #3
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful

    Thumbs up

    Very nice tutorial. Well explained. I didn't knew it before. Thank you so much

  5. The Following User Says Thank You to MJLover For This Useful Post:

    NextGen1 (03-25-2010)

  6. #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
    I assumed a-lot of people didn't know about the feature cause I always see questions and answers in regards to user settings and I myself answer the question even though the property grid and binding settings to it is so much cleaner (IMO)

    Plus you can include descriptions and let the user sort settings etc etc, so much more professional looking ;p

    Last edited by NextGen1; 03-24-2010 at 04:58 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  7. #5
    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,971
    My Mood
    Happy
    Now I learned something new, thanks next.

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

    NextGen1 (03-25-2010)

  9. #6
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,109
    thank you very much for this tutorial



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

    NextGen1 (03-25-2010)

  11. #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
    Added to tutorials list.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  12. #8
    bbhing987's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    ng
    Posts
    58
    Reputation
    10
    Thanks
    2
    nice release

  13. #9
    Devient_'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Utah,Salt Lake Posts: 4,382
    Posts
    882
    Reputation
    8
    Thanks
    25
    My Mood
    Breezy
    i always wondered how to use my.settgins and was going to get a book on it but now u saved me money

  14. #10
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,685
    My Mood
    Mellow
    Quote Originally Posted by bbhing987 View Post
    nice release
    nice bump .

    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)

  15. #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
    Watch the Bumps, I hate closing tuts. So don't bump topics older then 7 days


     


     


     



    The Most complete application MPGH will ever offer - 68%




  16. #12
    /b/oss's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    13,651
    Reputation
    795
    Thanks
    3,547
    why he ins't banned?

    nextgen gimmie your mod and i'll ban this bumper for ya XD i got nice message in my mind

  17. #13
    mizzer3's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    MPGH.net
    Posts
    888
    Reputation
    7
    Thanks
    171
    My Mood
    Sleepy
    nice release nextgen. good job!
    Heal Ur Allies, And You Will Win The War.



    RESPECT LIST :

    - Very Good Friend - Sn0wn00b
    - All the Mpgh minions ( special m3 )
    - th3reaper
    - respeckt52
    - s3liskar
    - thecamels8

  18. #14
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,685
    My Mood
    Mellow
    Quote Originally Posted by mizzer3 View Post
    nice release nextgen. good job!
    Indeed it was....6 months ago /

    Not taking anything away from the tut itself, I really like it NG

    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)

  19. #15
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    I didn't ban him cause he is new, a warning is sufficient for now, if it happens again, then he is breaking a rule he was made aware of. Make Sense? @ Tut Yeah, just a way to allow users to modify settings easily.


     


     


     



    The Most complete application MPGH will ever offer - 68%




Page 1 of 2 12 LastLast

Similar Threads

  1. [VB.NET Tut] Saving Settings With My.Settings
    By TheBest-1337 in forum Programming Tutorials
    Replies: 1
    Last Post: 02-26-2011, 11:26 AM
  2. *TUT* for Setting Up Hacks for Combat Arms
    By X0Chocolate0X in forum Combat Arms Hacks & Cheats
    Replies: 33
    Last Post: 07-30-2009, 11:56 PM
  3. [Tut] How to set your own chams
    By Diisasta in forum CrossFire Hacks & Cheats
    Replies: 53
    Last Post: 06-20-2009, 07:46 AM
  4. Realse+Tut|Colour "OGC AimBot"/How To Setting\
    By almog6666 in forum Combat Arms Europe Hacks
    Replies: 15
    Last Post: 03-14-2009, 10:21 AM
  5. [Tut]Set up 65k + Any Map with WPE Pro
    By jerry0 in forum Combat Arms Hacks & Cheats
    Replies: 73
    Last Post: 08-14-2008, 09:29 PM