Results 1 to 8 of 8

Thread: Check box Question....

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    67
    I am using a check box to toggle a text box's visible state from tru to false. This is what I have:

    Private Sub chk1_Click()

    If chk1.Enabled = True Then
    Text3.Visible = True

    Else

    chk1.Enabled = False
    Text3.Visible = False

    End If
    End Sub

    When the program starts, Text3 is hidden as it should be. When you check the box, Text3 appears as it should. But when you uncheck the box, Text3 does not dissappear as it should. What didn't I do?

    Thank You.

  2. #2
    Addicted Member
    Join Date
    Nov 2000
    Posts
    143
    I believe with Check Boxes You must
    use '0' , '1' instead of true and false.
    I think checkboxes check for integers.

    So
    if chk1 = 0 then
    yack yack
    else
    if chk1 =1 then
    yack yack.
    end if.



  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    67

    That was it! Thank you.

    Yack.

  4. #4
    Addicted Member
    Join Date
    Nov 2000
    Posts
    143
    np

  5. #5
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Try this:

    Code:
    Private Sub Check1_Click()
    Text1.Visible = Check1.Value
    End Sub
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  6. #6
    Guest
    To make life easier, how about this simple little method?

    Code:
    Private Sub Check1_Click()
    Text3.Visible = Not Text3.Visible
    End Sub

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    67
    even better, Thank you!

  8. #8
    Junior Member
    Join Date
    Oct 2000
    Posts
    18
    Code:
    If Check1.Value = vbChecked Then Text1.Visible = True Else Text1.Visible = False

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