vbs msgbox help

Discussion in 'Windows - General discussion' started by bizkit101, Sep 30, 2009.

  1. bizkit101

    bizkit101 Member

    Joined:
    Sep 4, 2008
    Messages:
    32
    Likes Received:
    0
    Trophy Points:
    16
    I am looking for a way to have a msgbox that if you press yes it does something.
    and if you press no it does something else.
    i read somewhere that there is like a number for each button that determines the response. but i cant find it.

    if you could give me a list of the numbers and a sample code for me to screw around with.

    and if you could do this with an inputbox that would help.
    i need it to say something like confirmed if they hit ok and say something like not confirmed if they hit cancel and dont type anything
     
  2. seb32

    seb32 Regular member

    Joined:
    Dec 31, 2005
    Messages:
    351
    Likes Received:
    0
    Trophy Points:
    26
    You need to specify the msgbox as a variable. So, for example:

    Code:
    Dim response
    
    response = MsgBox("Choose yes or no!",vbYesNo)
    
    If response = vbYes Then 
     MsgBox("You clicked yes!")
    Else
     MsgBox("You clicked no!")
    EndIf
    Have a look here for a more detailed explaination.
     
    Last edited: Oct 1, 2009

Share This Page