Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.Net - Cancel Button

Posted on 2014-03-10
5
Medium Priority
?
419 Views
Last Modified: 2014-03-18
Good Day Experts!

I have an application that has a main tab control.  Several of the tabs have longer running processes.  I do ask "Are you sure?" behind all of the button clicks, but several time Users click buttons then realize that they want to cancel.

The only way to get out of the process is to exit the application and go back in.

Is it possible to have a <Cancel> button on the UI to exit out of the current process?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 39918869
Is the long running process executing in a new Thread or is it executing in the button click event?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 39918995
Possibly...it depends on how you started those "processes".
0
 

Author Comment

by:Jimbo99999
ID: 39920241
Hello, thanks for responding.  They are all executed behind a button click.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 39920281
Perhaps you can show the code behind one of these buttons?
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 39920405
In that case what you can do is place a statement:

Application.DoEvents( )

In the program flow, with in a loop so that it can momentarily breakout of the executing code to handle the events, such as clicking a Cancel button then after the DoEvents check a variable set up by you in code to be the cancel variable. If this variable is true then have your code break out of the executing long process reseting the cancel variable just before leaving so it is ready for the next time. In the Cancel button set the cancel variable.

Please note that this will not work if within the button click event that run the long process is making a blocking call to some other system or a Database call that takes a long time because at that point you no longer have control but are waiting for a response.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question