Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralAs with anything that seems difficult Pin
Ennis Ray Lynch, Jr.28-Jul-09 16:06
Ennis Ray Lynch, Jr.28-Jul-09 16:06 
GeneralRe: App with Crystal Reports Pin
CodingYoshi29-Jul-09 6:01
CodingYoshi29-Jul-09 6:01 
GeneralRe: App with Crystal Reports Pin
Ennis Ray Lynch, Jr.29-Jul-09 6:04
Ennis Ray Lynch, Jr.29-Jul-09 6:04 
QuestionMono.Cecil (IL Manipulation) : What's OpCode ? Pin
hdv21228-Jul-09 10:55
hdv21228-Jul-09 10:55 
AnswerRe: Mono.Cecil (IL Manipulation) : What's OpCode ? Pin
Curtis Schlak.28-Jul-09 13:50
Curtis Schlak.28-Jul-09 13:50 
QuestionMessage Removed Pin
28-Jul-09 9:10
professionalN_tro_P28-Jul-09 9:10 
AnswerRe: Can this be refractored Pin
martin_hughes28-Jul-09 12:41
martin_hughes28-Jul-09 12:41 
Questionbutton onclick event Pin
djg28-Jul-09 8:57
djg28-Jul-09 8:57 
To whom it may concern,

I have a button onclick event, where I disable the button (setting its enable property to false), have some process which takes some time, and then reenabling the button at the end of the onclick event function. My query is that the onclick event is fired even though the button has been disabled (clicking more than once while the button is still disabled).

The following snippet illustrates the problem. Any solutions are appreciated.

private void button1_Click(object sender, EventArgs e)
{
DateTime d1, d2;
TimeSpan t;
d1 = DateTime.Now;

if (button1.Enabled == false)
return;

button1.Enabled = false;
while (true)
{
d2 = DateTime.Now;
t = d2.Subtract(d1);
if (t.TotalMilliseconds > 2000)
break;
}

label1.Text = (count++).ToString(); // shows the number of times the function has been called (count is a global variable)
label1.Refresh();

button1.Enabled = true;
}

Thanks in advance
AnswerRe: button onclick event Pin
musefan28-Jul-09 9:29
musefan28-Jul-09 9:29 
GeneralRe: button onclick event Pin
djg28-Jul-09 9:57
djg28-Jul-09 9:57 
GeneralRe: button onclick event [modified] Pin
musefan28-Jul-09 10:19
musefan28-Jul-09 10:19 
AnswerRe: button onclick event Pin
PIEBALDconsult28-Jul-09 9:29
mvePIEBALDconsult28-Jul-09 9:29 
GeneralRe: button onclick event Pin
djg28-Jul-09 10:05
djg28-Jul-09 10:05 
GeneralRe: button onclick event Pin
musefan28-Jul-09 10:28
musefan28-Jul-09 10:28 
GeneralRe: button onclick event Pin
PIEBALDconsult28-Jul-09 10:38
mvePIEBALDconsult28-Jul-09 10:38 
AnswerRe: button onclick event Pin
PIEBALDconsult28-Jul-09 10:03
mvePIEBALDconsult28-Jul-09 10:03 
QuestionArticle not added yet !!! Pin
HiteshSharma28-Jul-09 8:17
HiteshSharma28-Jul-09 8:17 
AnswerRe: Article not added yet !!! Pin
DaveyM6928-Jul-09 8:22
professionalDaveyM6928-Jul-09 8:22 
AnswerRe: Article not added yet !!! Pin
PIEBALDconsult28-Jul-09 8:27
mvePIEBALDconsult28-Jul-09 8:27 
AnswerRe: Article not added yet !!! Pin
Robin_Roy28-Jul-09 23:55
Robin_Roy28-Jul-09 23:55 
GeneralRe: Article not added yet !!! Pin
HiteshSharma29-Jul-09 0:01
HiteshSharma29-Jul-09 0:01 
QuestionModal form from modal form Pin
RobScripta28-Jul-09 7:39
professionalRobScripta28-Jul-09 7:39 
AnswerRe: Modal form from modal form Pin
musefan28-Jul-09 7:54
musefan28-Jul-09 7:54 
AnswerRe: Modal form from modal form Pin
Alan N28-Jul-09 7:56
Alan N28-Jul-09 7:56 
AnswerRe: Modal form from modal form Pin
Abhishek Sur28-Jul-09 7:56
professionalAbhishek Sur28-Jul-09 7:56 

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.