PDA

Click to See Complete Forum and Search --> : Check this problem with my checkbox !!!


Corne
Jan 13th, 2000, 08:04 PM
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.

Inhumanoid
Jan 13th, 2000, 08:40 PM
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

netSurfer
Jan 13th, 2000, 09:29 PM
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 :-)

r0ach
Jan 13th, 2000, 09:30 PM
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' :D
------------------
r0ach(tm)

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

Clunietp
Jan 14th, 2000, 11:14 AM
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

r0ach
Jan 14th, 2000, 11:53 AM
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!