Results 1 to 5 of 5

Thread: [RESOLVED] msgbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Location
    Bosnia and Herzegovina
    Posts
    65

    Resolved [RESOLVED] msgbox

    hi,

    When I call a msgbox like this

    VB Code:
    1. MsgBox "Exit", vbYesNo

    how do an if command for yes and no ?

    bye

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: msgbox

    VB Code:
    1. dim intRes as integer
    2.  
    3. intRes = MsgBox("Exit",vbYesNo)
    4. if intRes = vbYes then
    5.    Exit code here  
    6. end if
    or
    VB Code:
    1. if msgbox("Exit",vbYesNo) = vbYes then
    2.       Exit code here
    3.   end if
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: msgbox

    VB Code:
    1. If MsgBox("Exit", vbYesNo) = vbYes Then
    2.    
    3.     Else
    4.    
    5.     End If
    6.    
    7.     'or
    8.    
    9.     Dim mBoxsResult As VbMsgBoxResult
    10.    
    11.     mBoxsResult = MsgBox("Exit", vbYesNo)
    12.    
    13.     Select Case mBoxsResult
    14.    
    15.     Case vbYes
    16.    
    17.     Case vbNo
    18.    
    19.     End Select

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Location
    Bosnia and Herzegovina
    Posts
    65

    Re: msgbox

    thank you both

  5. #5
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: [RESOLVED] msgbox

    If you wanted to put one of the little pictures on the messagebox you could do it like this...

    VB Code:
    1. If MsgBox("Would you like to exit?", vbQuestion + vbYesNo) = vbYes Then
    2.      Unload Me 'They clicked Yes
    3. End If
    This would but the little question picture on it....theres several available when your typing the code it should show up with the list of available pics.
    Chris

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