Results 1 to 5 of 5

Thread: OK/Cancel Buttons?

  1. #1

    Thread Starter
    Lively Member fujiyama17's Avatar
    Join Date
    Aug 2000
    Location
    Columbus, OH
    Posts
    91

    Question

    Can someone give me the script for simple OK/cancel buttons on a form? With the focus on the OK button like Windows? That would be awesome!! Thanks!!

    ~Brian

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    Draw two buttons on the form. Name on cmdOK and the other cmdCancel.

    Make the caption on cmdOK "&OK" and change the default property to "True".

    Make the caption on cmdCancel "&Cancel".

  3. #3
    Guest
    Then place the statement Unload Me in cmdCancel.
    Code:
    Private Sub cmdCancel_Click()
        'Unloads the Form
        Unload Me
    End Sub

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Also if you set the Cancel property to True for the Cancel button the user can press the Escape key and the Click event will be raised.

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    '<< or >>

    Code:
    'a command button called Quit
    
    Private Sub Quit_Click()
    
        Dim lResult As Long
        
        lResult = (MsgBox("Do You Really Want To Quit?", vbYesNo, "Quit Application"))
        
        If lResult = 6 Then
           Dim Form As Form
             For Each Form In Forms
                 Unload Form
                 Set Form = Nothing
              Next Form
        Else
            Exit Sub  'or whatever you want to do
        End If
    
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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