Click here to Skip to main content
15,915,508 members
Home / Discussions / C#
   

C#

 
GeneralRe: So, what now? Pin
Jordy "Kaiwa" Ruiter12-May-10 10:29
Jordy "Kaiwa" Ruiter12-May-10 10:29 
QuestionSOAP request/response messages in WCF Pin
Gktony12-May-10 1:02
Gktony12-May-10 1:02 
AnswerRe: SOAP request/response messages in WCF Pin
Abhinav S12-May-10 1:08
Abhinav S12-May-10 1:08 
Questionaccessing events Pin
i gr812-May-10 0:49
i gr812-May-10 0:49 
AnswerRe: accessing events Pin
OriginalGriff12-May-10 1:24
mveOriginalGriff12-May-10 1:24 
GeneralRe: accessing events Pin
Luc Pattyn12-May-10 1:52
sitebuilderLuc Pattyn12-May-10 1:52 
GeneralRe: accessing events Pin
OriginalGriff12-May-10 1:56
mveOriginalGriff12-May-10 1:56 
QuestionHow to disable event handler from its execution Pin
sandeepkavade12-May-10 0:27
sandeepkavade12-May-10 0:27 
Hi I am having button on form in C#. It does take 2-3 seconds to complete the operation meanwhile the button is disabled. But if the user clicks on that button when it is disabled, after completion of first operation it will again try to execute the handler again. how should I avoid the execution of event handler when the button is disabled?

here is the code snippet:

public partial class Form1 : Form
{
int i = 0;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
this.button1.Enabled = false;
System.Threading.Thread.Sleep(3000);
i++;
this.label1.Text = "Total Calls: " + i.ToString();
this.button1.Enabled = true;
}
}

when the button is disabled and you click on it, you can see the count gets increased.

Please help
AnswerRe: How to disable event handler from its execution Pin
Peace ON12-May-10 0:33
Peace ON12-May-10 0:33 
GeneralRe: How to disable event handler from its execution Pin
sandeepkavade12-May-10 0:50
sandeepkavade12-May-10 0:50 
AnswerRe: How to disable event handler from its execution Pin
PIEBALDconsult12-May-10 2:51
mvePIEBALDconsult12-May-10 2:51 
GeneralRe: How to disable event handler from its execution Pin
sandeepkavade12-May-10 3:00
sandeepkavade12-May-10 3:00 
GeneralRe: How to disable event handler from its execution Pin
PIEBALDconsult12-May-10 3:03
mvePIEBALDconsult12-May-10 3:03 
GeneralRe: How to disable event handler from its execution Pin
sandeepkavade12-May-10 3:11
sandeepkavade12-May-10 3:11 
AnswerRe: How to disable event handler from its execution Pin
Luc Pattyn12-May-10 3:51
sitebuilderLuc Pattyn12-May-10 3:51 
GeneralRe: How to disable event handler from its execution Pin
dybs12-May-10 18:09
dybs12-May-10 18:09 
GeneralRe: How to disable event handler from its execution Pin
Luc Pattyn13-May-10 3:11
sitebuilderLuc Pattyn13-May-10 3:11 
AnswerRe: How to disable event handler from its execution Pin
Stanciu Vlad12-May-10 20:02
Stanciu Vlad12-May-10 20:02 
QuestionISP Bandwidth Measure [modified] Pin
Omoniyi Ogunderu11-May-10 23:20
Omoniyi Ogunderu11-May-10 23:20 
AnswerRe: ISP Bandwidth Measure Pin
OriginalGriff11-May-10 23:22
mveOriginalGriff11-May-10 23:22 
GeneralRe: ISP Bandwidth Measure Pin
Omoniyi Ogunderu11-May-10 23:39
Omoniyi Ogunderu11-May-10 23:39 
AnswerRe: ISP Bandwidth Measure Pin
Michel Godfroid11-May-10 23:54
Michel Godfroid11-May-10 23:54 
AnswerRe: ISP Bandwidth Measure Pin
Bernhard Hiller12-May-10 3:23
Bernhard Hiller12-May-10 3:23 
GeneralRe: ISP Bandwidth Measure Pin
harold aptroot12-May-10 3:32
harold aptroot12-May-10 3:32 
Questionwhat can I do to my poorful combobox to be filled???? Pin
Tunisien8611-May-10 23:13
Tunisien8611-May-10 23:13 

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.