Click here to Skip to main content
16,004,969 members
Home / Discussions / C#
   

C#

 
QuestionHow much exception handling is to much? Pin
KevinMac6-Jan-05 6:26
KevinMac6-Jan-05 6:26 
AnswerRe: How much exception handling is to much? Pin
Andy Brummer6-Jan-05 7:57
sitebuilderAndy Brummer6-Jan-05 7:57 
GeneralRe: How much exception handling is to much? Pin
Heath Stewart6-Jan-05 13:52
protectorHeath Stewart6-Jan-05 13:52 
GeneralRe: How much exception handling is to much? Pin
Andy Brummer6-Jan-05 16:06
sitebuilderAndy Brummer6-Jan-05 16:06 
GeneralAnother C to c# help.... Pin
Blubbo6-Jan-05 5:48
Blubbo6-Jan-05 5:48 
GeneralRe: Another C to c# help.... Pin
Heath Stewart6-Jan-05 13:41
protectorHeath Stewart6-Jan-05 13:41 
GeneralDisabled Button still accepts presses Pin
mikey_g6-Jan-05 5:45
mikey_g6-Jan-05 5:45 
GeneralRe: Disabled Button still accepts presses Pin
Nick Parker6-Jan-05 7:04
protectorNick Parker6-Jan-05 7:04 
mikey_g wrote:
The problem is that if I press during the task (the text is grayed so I know it actually has been disabled) as soon as the computation has completed and the button is re-enabled, it remembers the button press from earlier and runs again

Any Ideas?


Hmm, that sounds strange, I would like to see the code. I put together a simple app that is defined as you described above and couldn't recreate it. Check the following:

using System;
using System.Threading;
using System.Collections;
using System.Windows.Forms;

public class MyClass : Form
{
	Button b;

	private void Initialize()
	{
		this.b = new Button();
		b.Text = "Click Me";
		b.Click += new EventHandler(bClick);
		this.Controls.Add(b);
	}
	
	private void bClick(object sender, EventArgs e)
	{
		b.Enabled = false;
		DoLongProc();
		b.Enabled = true;
	}
	
	private void DoLongProc()
	{
		Thread.Sleep(5000);	
		MessageBox.Show("Done now");
	}
	
	public static void Main()
	{
		MyClass m = new MyClass();
		m.Initialize();
		m.ShowDialog();
	}
}


- Nick Parker
Microsoft MVP - Visual C#
My Blog | My Articles

GeneralRe: Disabled Button still accepts presses Pin
mikey_g6-Jan-05 23:33
mikey_g6-Jan-05 23:33 
GeneralXML Bulk Loader (SQLXML 3.0) Pin
exhaulted6-Jan-05 3:43
exhaulted6-Jan-05 3:43 
GeneralRe: XML Bulk Loader (SQLXML 3.0) Pin
perlmunger6-Jan-05 5:37
perlmunger6-Jan-05 5:37 
GeneralInfragistics UltraCalendarInfo control Pin
eliea6-Jan-05 1:45
eliea6-Jan-05 1:45 
GeneralRe: Infragistics UltraCalendarInfo control Pin
Nick Parker6-Jan-05 6:50
protectorNick Parker6-Jan-05 6:50 
Generalmodifying xml field data's using c# Pin
dhol6-Jan-05 1:42
dhol6-Jan-05 1:42 
GeneralRe: modifying xml field data's using c# Pin
perlmunger6-Jan-05 5:43
perlmunger6-Jan-05 5:43 
GeneralRe: modifying xml field data's using c# Pin
dhol6-Jan-05 16:38
dhol6-Jan-05 16:38 
GeneralRe: modifying xml field data's using c# Pin
perlmunger7-Jan-05 6:27
perlmunger7-Jan-05 6:27 
GeneralRe: modifying xml field data's using c# Pin
dhol7-Jan-05 17:05
dhol7-Jan-05 17:05 
GeneralMethod return Value Pin
webhay5-Jan-05 23:43
webhay5-Jan-05 23:43 
GeneralRe: Method return Value Pin
Stefan Troschuetz5-Jan-05 23:59
Stefan Troschuetz5-Jan-05 23:59 
GeneralRe: Method return Value Pin
haimlz6-Jan-05 1:02
haimlz6-Jan-05 1:02 
GeneralRe: Method return Value Pin
Salil Khedkar6-Jan-05 1:07
Salil Khedkar6-Jan-05 1:07 
GeneralXmlDocument Write problems and Add Identation Help! Pin
Chua Wen Ching5-Jan-05 23:40
Chua Wen Ching5-Jan-05 23:40 
GeneralRe: XmlDocument Write problems and Add Identation Help! Pin
Stanimir_Stoyanov6-Jan-05 0:07
Stanimir_Stoyanov6-Jan-05 0:07 
GeneralRe: XmlDocument Write problems and Add Identation Help! Pin
J4amieC6-Jan-05 3:03
J4amieC6-Jan-05 3:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.