I don't understand what you mean. The CancelButton property of
a form closes that form and returns a DialogResult of Cancel if
that form is shown by using ShowDialog. If you want code to be
run when this button is clicked, just add code in its Click event handler.
The InputBox function (which is from VB6 and shouldn't be used)
only returns a String, so I'm not sure where the CancelButton
comes into play here. You can check if the return string is empty
to see if the user pressed Cancel, if that's what you mean.