Results 1 to 3 of 3

Thread: Registry question.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66

    Smile

    I am writing an application just for fun and practice, I want the user to able to change the color of the form and the text, so I have command buttons that pull up the custom pallete. I put in the command click event the following code.

    SaveSetting appname:="csClient", Section:="Prferences", Key:="BackColor", Setting:=cmdChangeColor.BackColor

    and in the form load event.

    dim result as variant
    result = GetSetting(appname:="csClient", Section:="Preferences", Key:="BackColor", Default:="")
    If result > " " Then
    frmClient.BackColor = result
    End If
    I can change the color of the form and the text but when I close and reopen it doesn't remember my changes.
    I think that I am putting the savesetting in the wrong procedure, I also tried it in the lost focus, but that didn't seem to work either. this has worked for me with font and font size before. Any suggestions?
    Thanks in advance, Cady

  2. #2
    Junior Member
    Join Date
    Apr 2000
    Posts
    22

    Cool

    You use SaveSetting like this:

    SaveSetting App.EXEName, "Preferences", "BackColor", cmdChangeColor.BackColor

    And GetSetting like this:

    result = GetSetting (App.EXEName, "Preferences", "BackColor", "")

    Ain I would make the If statement this:

    If result <> "" Then
    frmClient.BackColor = result
    End If

    PS: You don't need the As Variant clase for the Dim statement, they are automatically Variant unless declared otherwise


    This sentence is a lie.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66

    Cool

    Thanks Philosopher, I got it to work with this.

    Dim lngBackColor As Long
    in general declarations

    and under cmdChangeColor:


    With CommonDialog1
    .Flags = cdlCCFullOpen
    .ShowColor
    BackColor = .Color

    End With

    lngBackColor = frmClient.BackColor
    SaveSetting "csClient", "STARTUP", "BackColor", lngBackColor

    and under formload:

    lngBackColor = GetSetting("csClient", "STARTUP", "BackColor", &H8000000F)
    frmClient.BackColor = lngBackColor

    thankyou for the help.
    Cady

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