Results 1 to 5 of 5

Thread: How to Lock a CheckBox

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    I want to lock a CheckBox there's no .Locked property on CheckBox and I DON'T WANT TO DISABLE IT.

    So if some one have hints, please Help.

    MageMinds

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600
    Hi MageMinds,

    Assuming that you don't want to make it invisible, you can try this code:
    Code:
    Check1.Value = 0
    in the click event of the check box. This will always keep it unchecked. Change 0 above to 1 if you always want it checked. However, it's neater to manipulate the check box by disabling or enabling it. But you don't want to do that for some reason.

    Hope this helps.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    I have tried to set the NOT value on the CLick Event but when I change it at Run Time the Click event is trigged, well I run Stack Overflow.

    The CheckBoxes doesn't have always the same value, values are from a Database.

    [Edited by MageMinds on 03-21-2000 at 12:43 PM]

  4. #4
    Junior Member
    Join Date
    Mar 2000
    Posts
    28
    Try this:

    Code:
    Option Explicit
    Private blDoneCheck As Boolean
    Private blWanttoLock As Boolean
    
    Private Sub Form_Load()
        blWanttoLock = False
    End Sub
    
    Private Sub Check1_Click()
        If blWanttoLock = True Then
            If blDoneCheck = True Then
                blDoneCheck = False
                Exit Sub
            End If
            
            If Check1.Value = 0 Then
                blDoneCheck = True
                Check1.Value = 1
            Else
                blDoneCheck = True
                Check1.Value = 0
            End If
        End If
    End Sub
    You need to have something like "blDoneCheck" because if you
    do check1.value = 0 it fires the Check1_Click event again and it will loop eternelly...


  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    3
    Thanks a lot ... I was looking for an API to do the job but it's working fine ...

    MageMinds

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