Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Slow application start Pin
fracalifa27-Apr-05 9:50
fracalifa27-Apr-05 9:50 
GeneralRe: Slow application start Pin
Luis Alonso Ramos27-Apr-05 5:42
Luis Alonso Ramos27-Apr-05 5:42 
GeneralRe: Slow application start Pin
Carl Mercier28-Apr-05 2:09
Carl Mercier28-Apr-05 2:09 
Generalsqldatareader Pin
sianatia26-Apr-05 21:23
sianatia26-Apr-05 21:23 
GeneralRe: sqldatareader Pin
Colin Angus Mackay26-Apr-05 23:14
Colin Angus Mackay26-Apr-05 23:14 
GeneralRe: sqldatareader Pin
sianatia26-Apr-05 23:26
sianatia26-Apr-05 23:26 
GeneralRe: sqldatareader Pin
Kodanda Pani26-Apr-05 23:33
Kodanda Pani26-Apr-05 23:33 
GeneralRe: sqldatareader Pin
Colin Angus Mackay26-Apr-05 23:34
Colin Angus Mackay26-Apr-05 23:34 

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.