Inputbox vbscript cancel button

Solved
lanaën Posted messages 15 Registration date   Status Member Last intervention   -  
lanaën Posted messages 15 Registration date   Status Member Last intervention   -
Hello everyone
I am a beginner in programming and I am trying to solve a problem I've encountered while creating my input box in vbscript.

To make a long story short, my program asks for the age and reacts based on the value entered; for now, nothing more basic. However, I've almost finished my program but when I press the cancel button, the program executes with a blank value (not a value like -1, just empty), so I am looking for the command in vbscript to make my program understand that when I click cancel, the input box should close.

I have already done some research online and several tests, but it still doesn't work. Can you please help me?

Configuration: Windows 7 / Firefox 5.0

2 answers

  1. Anonymous user
     
    Hello,

    Typical example:

     '------------------------------------------- ' ' VBS Script ' Dim Response Response = InputBox("Question", "Title", "Default") If Response = "" Then WScript.Echo "Cancel" Else If (Response <> "") Then WScript.Echo Response End If End If WScript.Quit(0) ' 


    Best regards

    Lupin

    '----------------------------------------------------------------
    Knowledge is acquired through experience,
    all the rest is just information.
    Albert Einstein
    0
  2. lanaën Posted messages 15 Registration date   Status Member Last intervention  
     
    I adapted and tested, and everything works perfectly. Thank you very much.
    0