Results 1 to 7 of 7

Thread: [RESOLVED] GetSetting easy question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Resolved [RESOLVED] GetSetting easy question

    What is wrong with this code, when i run the program i get the message: Type Mismatch

    Code:
    ChkTray.Value = GetSetting("SecApp", "Restrict", "NoTray", "")
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: GetSetting easy question

    GetSetting returns a string. Try

    ChkTray.Value = CBool(GetSetting("SecApp", "Restrict", "NoTray", "False"))

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Re: GetSetting easy question

    now i get the error invalid value because the value is a number - 1 or 0

    and if a put false it will set the value as false thats why mine was ""
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  4. #4
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: GetSetting easy question

    Assuming ChkTray is a checkbox, the value property needs an integer of 0, 1 or 2.

    Code:
    ChkTray.Value = CInt(GetSetting("SecApp", "Restrict", "NoTray", "0"))

  5. #5
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: GetSetting easy question

    My bad Mixed up radio button with checkbox values.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Re: GetSetting easy question

    thanks to both of you.

    Shoolbusdriver i will give you reputation when i can it says i should spread some round, even though u ave helped me a lot of times.
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  7. #7
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: [RESOLVED] GetSetting easy question

    Happy to help

    (@leinad31, I do it regularly )

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