Click here to Skip to main content
15,886,798 members
Home / Discussions / C#
   

C#

 
AnswerRe: Very Simple Question Pin
V.23-Mar-17 20:19
professionalV.23-Mar-17 20:19 
GeneralRe: Very Simple Question Pin
Richard MacCutchan23-Mar-17 22:43
mveRichard MacCutchan23-Mar-17 22:43 
AnswerRe: Very Simple Question Pin
OriginalGriff23-Mar-17 23:36
mveOriginalGriff23-Mar-17 23:36 
Questionmessagebox problem when process completed Pin
Akshit.b23-Mar-17 0:17
Akshit.b23-Mar-17 0:17 
AnswerRe: messagebox problem when process completed Pin
Richard MacCutchan23-Mar-17 2:08
mveRichard MacCutchan23-Mar-17 2:08 
AnswerRe: messagebox problem when process completed Pin
Dave Kreskowiak23-Mar-17 2:43
mveDave Kreskowiak23-Mar-17 2:43 
AnswerRe: messagebox problem when process completed Pin
Gerry Schmitz23-Mar-17 17:41
mveGerry Schmitz23-Mar-17 17:41 
AnswerRe: messagebox problem when process completed Pin
Luc Pattyn24-Mar-17 4:27
sitebuilderLuc Pattyn24-Mar-17 4:27 
Hi,

you seem to create one BackgroundWorker and reuse it over and over. Be aware that each time you execute a line such as
bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);

you ADD a handler to the event, so the second time the event fires, it will execute the same handler twice.
As this also applies to your line
bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);

I expect your BGW will duplicate its work and the number of results will behave quadratically.


There are several remedies:
1) you could remove the handlers with similar lines, say
bgw.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);


2) you could create a new BackgroundWorker each time;
3) but why not stuff all the work inside the bgw_DoWork method, and run the BackgroundWorker only once?

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum


modified 24-Mar-17 10:37am.

GeneralRe: messagebox problem when process completed Pin
Akshit.b26-Mar-17 20:22
Akshit.b26-Mar-17 20:22 
QuestionHow to write a generic code to make async call to Rest Service Pin
ArunHanu22-Mar-17 0:31
ArunHanu22-Mar-17 0:31 
AnswerRe: How to write a generic code to make async call to Rest Service Pin
Nathan Minier22-Mar-17 1:13
professionalNathan Minier22-Mar-17 1:13 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
ArunHanu22-Mar-17 1:43
ArunHanu22-Mar-17 1:43 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Pete O'Hanlon22-Mar-17 2:03
mvePete O'Hanlon22-Mar-17 2:03 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Nathan Minier22-Mar-17 2:08
professionalNathan Minier22-Mar-17 2:08 
SuggestionRe: How to write a generic code to make async call to Rest Service Pin
Richard Deeming22-Mar-17 2:23
mveRichard Deeming22-Mar-17 2:23 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
ArunHanu22-Mar-17 3:06
ArunHanu22-Mar-17 3:06 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Nathan Minier22-Mar-17 3:53
professionalNathan Minier22-Mar-17 3:53 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Richard Deeming22-Mar-17 4:20
mveRichard Deeming22-Mar-17 4:20 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Nathan Minier22-Mar-17 4:59
professionalNathan Minier22-Mar-17 4:59 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Richard Deeming22-Mar-17 5:26
mveRichard Deeming22-Mar-17 5:26 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Nathan Minier22-Mar-17 6:06
professionalNathan Minier22-Mar-17 6:06 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Richard Deeming22-Mar-17 6:16
mveRichard Deeming22-Mar-17 6:16 
GeneralRe: How to write a generic code to make async call to Rest Service Pin
Nathan Minier23-Mar-17 1:12
professionalNathan Minier23-Mar-17 1:12 
QuestionWindows 10 Thin Border Cause a space issue compare to windows 8 Pin
Member 979968321-Mar-17 20:12
Member 979968321-Mar-17 20:12 
AnswerRe: Windows 10 Thin Border Cause a space issue compare to windows 8 Pin
Gerry Schmitz23-Mar-17 17:52
mveGerry Schmitz23-Mar-17 17:52 

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.