CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Message Boxes

  1. #1

    Message Boxes

    How do I detect which button was pressed on a Message Box? Such as Yes, No, Cancel, etc...?


  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: Message Boxes

    Dim RET As Integer
    RET = MsgBox("HI", vbYesNoCancel)
    If RET = vbYes Then Debug.Print "yes"
    If RET = vbNo Then Debug.Print "no"
    If RET = vbCancel Then Debug.Print "cancel"


    David Paulson

  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Message Boxes


    Select Case MsgBox("Proceed?", vbYesNoCancel)
    Case vbYes
    'proceed with operation
    cAse vbNo
    'stop operation
    Case vbCancel
    'cancel operation
    End Select




    Same as the other answer but slightly more elegant layout.

    HTH,
    D.

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

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

Featured