Results 1 to 2 of 2

Thread: Save command?

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    5

    Save command?

    What code should I use to make save and load commands? It's for storing variables that can be re-loaded by the user after shutting the program down.

    Let's say I have integer "apple", boolean "orange" and string "banana" variables. What's the code I would need?

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Save command?

    Welcome to the forums

    You can use the registry...

    Add one TextBox named Text1 to your Form. Run the code, type something, unload and re-load. It will re-load your setting (what you've typed):
    VB Code:
    1. Option Explicit
    2.     Private myString As String
    3.  
    4. Private Sub Form_Load()
    5.     myString = GetSetting("myApp", "Settings", "myString", vbNullString)
    6.         Text1.Text = myString
    7. End Sub
    8.  
    9. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    10.     myString = Text1.Text
    11.         SaveSetting "myApp", "Settings", "myString", myString
    12. End Sub

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