Click here to Skip to main content
15,919,500 members
Home / Discussions / C#
   

C#

 
GeneralRe: Regarding Mouse Move event!! Pin
MoustafaS27-Apr-05 5:18
MoustafaS27-Apr-05 5:18 
Generalchange keyboard layout Pin
El'Cachubrey27-Apr-05 1:17
El'Cachubrey27-Apr-05 1:17 
Generalserializing in client Pin
balkang27-Apr-05 1:00
balkang27-Apr-05 1:00 
GeneralRe: serializing in client Pin
Judah Gabriel Himango27-Apr-05 7:52
sponsorJudah Gabriel Himango27-Apr-05 7:52 
GeneralRe: serializing in client Pin
balkang27-Apr-05 9:36
balkang27-Apr-05 9:36 
GeneralRe: serializing in client Pin
Judah Gabriel Himango27-Apr-05 9:44
sponsorJudah Gabriel Himango27-Apr-05 9:44 
Generalconvert types Pin
eng.mohamed27-Apr-05 0:40
eng.mohamed27-Apr-05 0:40 
GeneralRe: convert types Pin
Colin Angus Mackay27-Apr-05 0:57
Colin Angus Mackay27-Apr-05 0:57 
GeneralRe: convert types Pin
Marc Clifton27-Apr-05 1:02
mvaMarc Clifton27-Apr-05 1:02 
Generalprint a pdf file from a web app Pin
brian5527-Apr-05 0:07
brian5527-Apr-05 0:07 
GeneralRe: print a pdf file from a web app Pin
Dave Kreskowiak27-Apr-05 1:44
mveDave Kreskowiak27-Apr-05 1:44 
Generalbutton click event Pin
gaby2r26-Apr-05 22:48
gaby2r26-Apr-05 22:48 
GeneralRe: button click event Pin
Polis Pilavas26-Apr-05 23:28
Polis Pilavas26-Apr-05 23:28 
GeneralRe: button click event Pin
Anonymous26-Apr-05 23:43
Anonymous26-Apr-05 23:43 
GeneralRe: button click event Pin
S. Senthil Kumar27-Apr-05 1:05
S. Senthil Kumar27-Apr-05 1:05 
GeneralRe: button click event Pin
gaby2r27-Apr-05 1:24
gaby2r27-Apr-05 1:24 
obviously you haven't payed attention to my first post. the first example does just that. disabling the button and enabling it after the task is done. however it doesn't behave as expected. Visualy the button is disabled, but the function executes as many times as you push the button, regardless of it's state (disabled/enabled). if you put a counter in it and look at it after the test you'll see it's nice and neat the number of clicks you made.
i think that this is because somehow it stacks the events and fires them after the function executes. try and run this code:
<br />
		public void task()<br />
		{<br />
			Thread.Sleep(1000);<br />
			this.counter++;<br />
		}<br />
		private void button1_Click(object sender, System.EventArgs e)<br />
		{<br />
			this.button1.Enabled=false;<br />
			Thread t=new Thread(new ThreadStart(task));<br />
			t.Start();<br />
			while((t.ThreadState & (System.Threading.ThreadState.Stopped | System.Threading.ThreadState.Unstarted)) == 0)<br />
			{<br />
				Thread.Sleep(100);<br />
			}<br />
			t.Join();<br />
			this.button1.Enabled=true;<br />
			Debug.WriteLine(this.counter);<br />
		}<br />

this has multi threading too. i can't exclude the possibility i'm doing something wrong but i can't seem to see where. pointers anyone?
GeneralRe: button click event Pin
S. Senthil Kumar27-Apr-05 3:55
S. Senthil Kumar27-Apr-05 3:55 
GeneralRe: button click event Pin
gaby2r27-Apr-05 4:14
gaby2r27-Apr-05 4:14 
GeneralRe: button click event Pin
Pete O'Hanlon27-Apr-05 4:38
mvePete O'Hanlon27-Apr-05 4:38 
GeneralRe: button click event Pin
gaby2r27-Apr-05 4:46
gaby2r27-Apr-05 4:46 
GeneralRe: button click event Pin
Enishi27-Apr-05 1:27
Enishi27-Apr-05 1:27 
GeneralRe: button click event Pin
gaby2r27-Apr-05 1:51
gaby2r27-Apr-05 1:51 
GeneralRe: button click event Pin
Ashok Dhamija27-Apr-05 3:36
Ashok Dhamija27-Apr-05 3:36 
GeneralSlow application start Pin
fracalifa26-Apr-05 21:36
fracalifa26-Apr-05 21:36 
GeneralRe: Slow application start Pin
Marc Clifton27-Apr-05 1:06
mvaMarc Clifton27-Apr-05 1:06 

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.