Results 1 to 3 of 3

Thread: Saving Option Settings

  1. #1
    Guest

    Question

    Can someone explain to me (in-depth), how to save settings like the backcolor and forecolor of a picture box.

  2. #2
    Hyperactive Member kourosh's Avatar
    Join Date
    Aug 1999
    Location
    Vancouver, British Columbia, Canada
    Posts
    256

    Cool

    You can save setting by using Savesetting function.

    savesetting app.path,"Settings","backcolor",form1.backcolor

    in this example setting is a registry section and backcolor is the registry key and form1.backcolor is the setting you want to save.

    To get the setting back from the registry:

    private sub form1_load()
    on error resume next
    dim Color
    color = getsetting(app.path,"settings","backcolor",vbblack)
    me.backcolor = color
    end sub

    in this example you have to give the same address as you gave the savesetting so the program can find the correct value. Then the program will store the value into color variable. And then assign the color variable value to the form backcolor.

    What is the purpose of (On error resume next)?
    well first you start the program you havn't saved anything in the registry therefore program can not return any value and you will get an error message, so you put the on error resume next on top to avoid this.

  3. #3
    Guest

    Question I Tried...

    I tried that and it saves but not the colors i told it to save and the things i dont want to change color, change color. What now?

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