Results 1 to 6 of 6

Thread: Check this problem with my checkbox !!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    South-Africa
    Posts
    46

    Post

    Thanks for everyones help so far!!

    Can you please help me with this!

    How do you save a check box values.
    Like the chk box is on but when i reload my form the chk box is off(value = 0)

    I know I must save it into a database?
    But How? Can anybody help?????? ;(
    I am using access as a db with odbc connectivity.

  2. #2
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309

    Post

    save the checkbox.value somewhere (0 if UNchecked, 1 if checked)
    Then when you reload the form you should let you app check that value and set checkbox.value to it....

    If you use that database for user-information I would not recommend using it for system settings...

    I recommend using another database or even better an ini-file

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    I wouldn't use an ini file, why mess with API calls plus too many people know to mess with them. I would just write the checkbox's value to a nonsense file. It depends on how secure you want to be, you can even hide it in a bunch of nonsense characters :-)

  4. #4
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Post

    Why not save the values in the registry?
    GetSetting(), etc.
    You can save all the values in one string, and read it with checkbox.value = Int(Mid(value,1,1)) where value is "101110101"

    Ahh, what a mess. Maybe you'll understand what i'm trying to say.

    if you don't, 'bel my, dan praat ons'
    ------------------
    r0ach(tm)

    [This message has been edited by r0ach (edited 01-14-2000).]

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Code:
    Private Sub Form_Load()
        Check1.Value = GetSetting(App.Title, "mysection", "check1", 0)
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        SaveSetting App.Title, "mysection", "check1", Check1.Value
    End Sub

  6. #6
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Post

    That's sorta what i had in mind. But if you have 40 checkboxes (?), you're gonna have a lotta lines in the registry.

    Adding all the values into one string, and then reading each one later again, alows you to have 40 checkboxes' values in one registry entry!

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