Results 1 to 10 of 10

Thread: [2005] Saving Variables

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    [2005] Saving Variables

    Hello, how do i make it so whenever a user closes the program it saves the values of all the variables so if the user changes a setting or types in his name it will recanize it next time the program is opened instead of setting the vvariables to their deafult settings. If i have to save a ini file or somethine how is this done?

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] Saving Variables

    Use your applications settings. Search this forum for Application Settings.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2005] Saving Variables

    You can save the variables in My.Settings and they will automatically be retrieved the next time the program starts.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: [2005] Saving Variables

    Hello i know about My.Settings but how exactly do i use my.settings i read something abotu it but i dont quite understand. How do i choose which variables are saved? do i set it as a string and the value as the variable name in settings? Please explain how my.settings works or how i can save it/load it.

  5. #5
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2005] Saving Variables

    You need to create the variables in the Settings tab in your project properties, and then just write My.Settings.[name of variable] and use it as a normal variable.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: [2005] Saving Variables

    How do i create them in the setting tab?

    I type under value dim variable as whatever?

  7. #7
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2005] Saving Variables

    In the settings tab, write the desired variable name in the Name column, then pick the type you want the variable to be, then pick a scope, and finally write the desired initial value of the variable in the Value column.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: [2005] Saving Variables

    nvm i understand the table is the spot where you set the variables, i didnt understand..lol

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: [2005] Saving Variables

    I mean i didnt understand the time i wrote the question asking where you write it..lol So these are going to be saved everytime the program shutsdown. Cant i also use this as a way to set global variables? then say if i dont want them to save i just add a bit of extra code that resets it.

    Thankyou

  10. #10
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2005] Saving Variables

    You're welcome. Could you explain a bit more, what do you mean 'global variables'? The variables in My.Settings (as long as they're set to User scope) are accessible from anywhere, and as for not saving them, I think there was a property, something like My.MySettings.SaveOnExit or so that you can change in order to specify whether you want them to save on exit or not. Check out the My proxy, you'll find some very useful stuff there.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

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