-
Hi,
I'm using the following code to uncheck/check a check box:
Code:
Private Sub picBPCredit_Click()
'-- check/uncheck the checkbox
If chkBPCredit.Value = 0 Then
chkBPCredit.Value = 1
Else
chkBPCredit.Value = 0
End If
End Sub
I know the above code can be reduced to 1 or 2 lines but I forgot how to do it.. The reduced code reads something like: "value of check box not equal to current value of check.." or something like that but I just can't figure it out..
Any help would be appreciated..
Dan
-
chkBPCredit.Value = - not(-chkBPCredit.Value)
-
<?>
chkBPCredit.Value = IIf(chkBPCredit.Value = 0, 1, 0)
-
Immediate if's are slow, i've heard
-
allmost the same as kedaman's, for some people maybe more readable:
chkBPCredit.Value = Abs(Not CBool(chkBPCredit.Value))
regards
Sascha
-
I try your code Kedaman cuz it's really short but it give me an error : Out of stack space.
Why and what is stack space??
-
Don't place it in chkBPCredit_Click, it will raise the same event over and over again until crashing.
If you click it will automatically check/uncheck
-
Oups!!!!
I really need some sleep
iiiihhaaaahh think i really need some sleep!
oup i just repeat myself
i think i ................