Results 1 to 3 of 3

Thread: Cancel Button!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Question

    how can i write a code for a cancel button that this set the value of all checkboxes on a form to "vbunchecked"?????

    f.Ex. checkbox 1 to 10 are "checked" , cancel button is down , value of checkbox 1 to 10 should be "vbunchecked"!

  2. #2
    Guest
    Try this:

    Code:
    Private Sub Command1_Click()
        For Each MyControl In Me.Controls
            If TypeOf MyControl Is CheckBox Then MyControl.Value = vbUnchecked
        Next
    End Sub

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Put a timer on a form, interval 1000, put the checkboxes in an array:
    Code:
    Private Sub Timer1_timer()
    Dim x As Integer
    For x = Check1.Lbound To Check1.Ubound
        If Check1(x).Value = False Then
            Command1.Enabled = False
            Exit Sub
        End If
    Next x
    Command1.Enabled = True
    End Sub
    Oh sh*t, didn't read your post with much concentration
    Use Matthew's code...

    I keep my code here for anyone who needs it sometime

    [Edited by Jop on 10-08-2000 at 03:49 PM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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