Results 1 to 9 of 9

Thread: How do you use the vbyesnocancel

  1. #1
    Guest

    Post

    Can anyone give me an example of code that would use this entire command?

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163

    Post

    I'm not sure what your asking but vbyesnocancel is used with the msgbox function. It gives you a meesage box that contains a yes, no and cancel button.

    msgbox "message",vbyesnocancel,"Title"

  3. #3
    Guest

    Post

    I know about the msg part, the part I need to know about is how it works, does it use an IF THEN ELSE statement, or what? Please show an example.

  4. #4
    Guest

    Post

    This is what I have...


    Private Sub savefile()
    MsgBox "Do you want to Submit another Problem", vbYesNo
    If vbYes Then
    clearfields
    Else
    MsgBox "We have been notified. Thank You."
    Unload Me
    End If
    End Sub

    This doesn't work...if I click no, it does the same thing as VBYES. What is wrong with this?

  5. #5
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408

    Post

    Here I will tell you again but thats ok
    dim happy as string

    Private Sub savefile()
    happy = MsgBox ("Do you want to Submit another Problem", vbYesNo)
    If happy = vbYes Then
    clearfields
    Else
    MsgBox "We have been notified. Thank You."
    Unload Me
    End If
    End Sub

    Sorry forgot () last time
    ------------------
    Sincerely,
    Chris
    :-) ;-)
    just have fun out there and live life to the fullest while it is still here
    Email pitbullcr7@aol.com



    [This message has been edited by PITBULLCJR (edited 02-02-2000).]

  6. #6
    Guest

    Post

    thanks again...

  7. #7
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Here:
    Code:
    Reply = MsgBox("Yes will continue, No will stop, and cancel will do nothing", 3, "Yes, No, and Cancel prompt")
    If Reply = 6 Then 'they hit Yes
        MsgBox "You hit Yes"
    ElseIf Reply = 7 Then 'they hit no
        MsgBox "You hit No"
    Else
        MsgBox "You hit cancel"
    End If
    Good luck.

    ------------------
    DiGiTaIErRoR
    VB, QBasic, Iptscrae, HTML
    Quote: There are no stupid questions, just stupid people.

  8. #8
    New Member
    Join Date
    Feb 2000
    Location
    haifa,israel
    Posts
    12

    Post

    the VbYesNo and others are simply consts for integer type
    while asking a message box (msgbox) to draw the VbYesNo or what ever command button you wish for, you simply check:

    result=msgbox("are you sure",VbYesNo)
    if result=VbYes then
    'do something
    end if



  9. #9
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Post

    Here is another one for you

    Code:
    Dim Response As Integer
    Response = MsgBox("Do you want to exit?", vbYesNoCancel + vbQuestion, "Exit?")
    Select Case Response
    Case vbYes
    MsgBox "You pressed Yes"
    Case vbNo
    MsgBox "You pressed No"
    Case vbCancel
    MsgBox "You pressed Cancel"
    End Select
    Hope this helps


    ------------------
    david
    Teenage Programmer


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