Click here to Skip to main content
15,929,554 members
Home / Discussions / C#
   

C#

 
AnswerRe: Without O(n2) Pin
Xodiak18-Jul-07 7:48
Xodiak18-Jul-07 7:48 
AnswerRe: Without O(n2) Pin
Luc Pattyn18-Jul-07 7:56
sitebuilderLuc Pattyn18-Jul-07 7:56 
AnswerRe: Without O(n2) Pin
dino209418-Jul-07 8:01
dino209418-Jul-07 8:01 
QuestionWindows XP Colors Pin
Whoami Whoami18-Jul-07 7:21
Whoami Whoami18-Jul-07 7:21 
AnswerRe: Windows XP Colors Pin
WillemM18-Jul-07 7:28
WillemM18-Jul-07 7:28 
GeneralRe: Windows XP Colors Pin
Scott Dorman18-Jul-07 8:36
professionalScott Dorman18-Jul-07 8:36 
AnswerRe: Windows XP Colors Pin
Scott Dorman18-Jul-07 8:35
professionalScott Dorman18-Jul-07 8:35 
QuestionCouldn't click any botton using BackgroundWorker Pin
pnpfriend18-Jul-07 6:51
pnpfriend18-Jul-07 6:51 
Hi,
I'm new to Threading..
After learning how to work with threading, I found out that I could use BackgroundWorker since I'm using VS 2005.
I also check on the example and try to do the same like following. However I couldn't click on Cancel Button after I click StartButton. I couldn't interrupt what my program is currenting doing.
I dont' know what I am doing it wrong. I couldnt' find the answer. Please help me. Thank you.

My form has StartButton, Cancel Button, Edit Text To Display the message
1) Add BackgroundWorker to my Form,
2) Set WorkerReportsProgress = False
3) WorkderSupportsCancella = True;
4) Add DoWork and RunWokerCompleted events
5) Add event to StartButton, and Cancel button.
6) Add functions:
Private void BrowseFileFolder(),that will browse the folder given and then get all file information.
private void BrowseFF(BackgroundWorker bk, DoWorkEventArgs e),
7) Add another function: public delegate void BrowseFFDelegate(); because i got error calling BrowseFileFolder() directly from DoWork().
8) OnStartButton() -> myBkWorker.RunWorkderAsync();

9)
<br />
OnMyBkWorker_DoWork(object sender, DoWorkEventArgs e) <br />
{<br />
BackgroundWorkder worker = sender as BackgroundWorkder;<br />
BrowseFF(worker,e);<br />
}<br />


10)
<br />
private void BroswerFF(BackgroundWorker bk, DoWorkEventArgs e)<br />
{<br />
BKWorker = worker;<br />
workerEvent = e;<br />
Invoke(new BrowseFFDelegate(BrowseFileFolder));<br />
}<br />

11)
<br />
private void BrowseFileFolder()<br />
{<br />
if(BKWorker.CancellationPending)<br />
{<br />
workerEvent.Cancel = true;<br />
return;<br />
}<br />
else<br />
{<br />
DirectoryInfo dirfolder = new DirectoryInfo(pathToBrowse);<br />
....<br />
....<br />
//Getting file and folder information <br />
....<br />
}<br />

}


Thank you.
AnswerRe: Couldn't click any botton using BackgroundWorker Pin
led mike18-Jul-07 7:23
led mike18-Jul-07 7:23 
GeneralRe: Couldn't click any botton using BackgroundWorker Pin
pnpfriend18-Jul-07 8:41
pnpfriend18-Jul-07 8:41 
GeneralRe: Couldn't click any botton using BackgroundWorker Pin
led mike18-Jul-07 9:54
led mike18-Jul-07 9:54 
GeneralRe: Couldn't click any botton using BackgroundWorker Pin
pnpfriend19-Jul-07 4:41
pnpfriend19-Jul-07 4:41 
GeneralRe: Couldn't click any botton using BackgroundWorker Pin
led mike19-Jul-07 6:43
led mike19-Jul-07 6:43 
GeneralRe: Couldn't click any botton using BackgroundWorker Pin
pnpfriend27-Jul-07 11:19
pnpfriend27-Jul-07 11:19 
GeneralRe: Couldn't click any botton using BackgroundWorker Pin
led mike30-Jul-07 5:14
led mike30-Jul-07 5:14 
QuestionWork with files Pin
suntromantralalalala18-Jul-07 6:31
suntromantralalalala18-Jul-07 6:31 
AnswerRe: Work with files Pin
BoneSoft18-Jul-07 6:39
BoneSoft18-Jul-07 6:39 
GeneralRe: Work with files Pin
suntromantralalalala18-Jul-07 6:47
suntromantralalalala18-Jul-07 6:47 
GeneralRe: Work with files Pin
BoneSoft18-Jul-07 9:10
BoneSoft18-Jul-07 9:10 
AnswerRe: Work with files Pin
BoneSoft18-Jul-07 9:12
BoneSoft18-Jul-07 9:12 
AnswerRe: Work with files Pin
PhilDanger18-Jul-07 8:11
PhilDanger18-Jul-07 8:11 
QuestionReusing a string value Pin
Raymond_P*18-Jul-07 5:28
Raymond_P*18-Jul-07 5:28 
AnswerRe: Reusing a string value Pin
BoneSoft18-Jul-07 5:39
BoneSoft18-Jul-07 5:39 
GeneralRe: Reusing a string value Pin
Raymond_P*18-Jul-07 5:52
Raymond_P*18-Jul-07 5:52 
GeneralRe: Reusing a string value Pin
Luc Pattyn18-Jul-07 5:57
sitebuilderLuc Pattyn18-Jul-07 5:57 

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.