Computer Science Canada

input box

Author:  pavol [ Thu Mar 16, 2006 5:56 pm ]
Post subject:  input box

simple question:
is there any way to know if the Cancel button was clicked on an input box?
this is why i wanna know
code:
pass = InputBox ("Please type in your new Password", "Password")
If (the Cancel button was clicked) Then
    (don't change the password)
End If

simple but it's driving me crazy Evil or Very Mad

Author:  cool dude [ Thu Mar 16, 2006 7:38 pm ]
Post subject: 

this is a little example program i made for u. if u need further help just post! Smile

code:

Dim password As String
Private Sub Form_Load()
password = InputBox("Please type in your new Password", "Password")
If password = "" Then
MsgBox "The password is the same"
Else
MsgBox "The password is " & password
End If
End Sub


Hope this helps Smile

Author:  pavol [ Thu Mar 16, 2006 8:05 pm ]
Post subject: 

thanks Very Happy , i knew there was a simple solution
i just thought that when cancel was pressed and something was written in the input box then the thing that was written in there still gets stored in the variable (for some strange reason)


: