473,721 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why "Continue" button is not enabled

I have two buttons on a form, "Pause" and "Continue".

When "Pause" button is clicked, it should:

1) Stop the background worker;
and, 2) Enable the "Continue" button.

I have the code below to explicitly enable the "Continue" button.
However, it's still not enabled. Anyone can tell me why? Thanks.

--------------------------------------------------------------------------------------------------------------------
protected void pauseButton_Cli ck(object sender, EventArgs e)
{
if (mBaseWorker.Ba ckgroundWorker != null)
{
mBaseWorker.Bac kgroundWorker.C ancelAsync();
}

this.continueBu tton.Enabled = true;
this.Refresh();

}
--------------------------------------------------------------------------------------------------------------------
Feb 8 '08 #1
4 1485
Is there any evidence that the backgroundworke r is canceled? I would try
catching any exceptions first in this routine. If you can't get past the
first block you would never see the enabled button. Also, refresh should not
be necessary.

"Curious" wrote:
I have two buttons on a form, "Pause" and "Continue".

When "Pause" button is clicked, it should:

1) Stop the background worker;
and, 2) Enable the "Continue" button.

I have the code below to explicitly enable the "Continue" button.
However, it's still not enabled. Anyone can tell me why? Thanks.

--------------------------------------------------------------------------------------------------------------------
protected void pauseButton_Cli ck(object sender, EventArgs e)
{
if (mBaseWorker.Ba ckgroundWorker != null)
{
mBaseWorker.Bac kgroundWorker.C ancelAsync();
}

this.continueBu tton.Enabled = true;
this.Refresh();

}
--------------------------------------------------------------------------------------------------------------------
Feb 9 '08 #2
If I put "this.continueB utton.Enabled = true;" before the block about
the background worker, the "Continue" button won't be enabled either,
although in the debugger, this line does get executed.
Feb 10 '08 #3
I normally would not pause a background process by cancelling it. Is it
possible the cancel code for the thread disables the continue button? I ask
this because if the thread is "canceled" it should not be able to be
"continued" .

"Curious" wrote:
If I put "this.continueB utton.Enabled = true;" before the block about
the background worker, the "Continue" button won't be enabled either,
although in the debugger, this line does get executed.
Feb 11 '08 #4
To give you an update, the "CancelAsync(); " method calls an
"UpdateControls " method that sets the "Continue" button to disabled.
I've fixed the code in these other methods and the "Continue" button
is enabled!
Feb 11 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
580
by: Harman Sahni | last post by:
As per this URL http://msdn.microsoft.com/library/en-us/vjref98/html/14_14.asp?frame=true conitnue works on for, while, do... I know it works for foreach as well as I'm using it somewhere. My question is how do I "continue" (jump an iteration) of an outermost loop from an inner loop. So I have something like this:
14
3660
by: Daniel Bass | last post by:
is there an equivalent key word for C++'s "continue" in VB (.net) in this context? CString szLine; szLine = myReader.ReadLine(); while ( !szLine.IsEmpty() ) { if ( szLine(0) == '-' ) {
14
19412
by: Jan Schmidt | last post by:
Hi, in a nested do-while-loop structure I would like to "continue" the outer loop. With goto this should be no problem in while-loops. However, for do-while I cannot get it to work (without a strange workaround construct): -- do { // ...
13
2005
by: xz | last post by:
What if I want the following: vector<intv; // v is loaded by push_back() switch( v.size() ) { case 2: //do something
36
2648
by: mdh | last post by:
May I ask the group this somewhat non-focused question....having now seen "continue" used in some of the solutions I have worked on. ( Ex 7-4 solution by Tondo and Gimpel comes to mind) Is there a good principle/s for the good usage of "continue"...or...do any of the regular/irregular contributors have a "favorite" way in which it is particularly useful. Thanks as usual.
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.