inputbox read vbyesno

Hi all how can i read if user  press cancelbutton on inputbox?

if cancel or no, then exit sub
but how can i read the cancel button?

thanks
edo
respuesta = InputBox("Que nombre le quiere dar a la espec " & sptempo & " ?", vbYesNo)
        If respuesta = "" Or vbNo Then
            Exit Sub
        Else

            cn.Open()

            Dim bus As String = "update P" & proyecto & " set spec='" & respuesta & "' where spec='" & sptempo & "' "

            Dim cmd2 As New OleDbCommand(bus, cn)
            renomb = (cmd2.ExecuteScalar())


            cn.Close()

            MsgBox("SPEC renombrada correctamente", MsgBoxStyle.Information)
            sptempo = respuesta
            Label1.Text = "PROYECTO:  " + proyecto + "ESPECIFICACION:  " + sptempo
        End If

Open in new window

ErnestoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Om PrakashCommented:
Use
If respuesta = "" Or vbNo Or vbCancel Then
instead of
If respuesta = "" Or vbNo Then
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ErnestoAuthor Commented:
do nothing if put that condition alwais go to exit sub
0
Om PrakashCommented:
You can just set the default value to a space then trim it off when you read the value.
string Result = Microsoft.VisualBasic.Interaction.InputBox(Prompt, Title, " ", 150, 150);
/* check to see it it's an empty string indicating they canceled. */
            if (Result != "")
            {
                       'update...
            }
http://www.codeguru.com/forum/showthread.php?t=356046
0
ErnestoAuthor Commented:
even the value isnt "" i need if press cancel button halt
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.