Simply said, I have a form with contains a button.
When the Click-Event is raised, a function is called which is connecting to a database and doing some more database-related stuff.
Now, sometimes the connection is taking its time to establish, and sometimes there is even no connection at all (which is fine and a common situation).
When this is happening, I want to give the user a opportunity to cancel whatever is happening.
A nice idea would be to cancel it upon a keydown-event (i.e. when pressing the ESC-key), so I added the KeyDown-Event and added this to it:
If (e.KeyCode = System.Windows.Forms.Keys.Escape) Then
//cancel function called in button.Click
End If
But how exactly can I cancel whatever is going on/exit the button.Click
-Sub?
With a similar issue i resolved it by: