Hey guys, I am very new to vbscript, and I am trying to write a script which will generate a random 5 digit number, display that code in a msgbox, and then ask for user input. It will then compare the entered code to the generated code, and if they match, make a msgbox "correct". I have made this script:
code = Int((max-min+1)*Rnd+min)
inCode = InputBox("Enter the 5 digit code","Enter Code")
If inCode = code Then msgbox "correct" Else msgbox "incorrect"
which works up to the if statement, where it will always be incorrect no matter what. I have also made this code:
InCode=InputBox("Enter the 5 digit code","Enter Code")
If InCode=12345 Then msgbox "correct"
which works, so I think that the problem might be with generating the random number. please let me know that you think. Thanks, thepi