Click here to Skip to main content
15,894,337 members
Home / Discussions / C#
   

C#

 
AnswerRe: manifest files Pin
jschell22-Jul-12 7:00
jschell22-Jul-12 7:00 
GeneralDeclare variable as Interface vs. Class Pin
trinh.nguyen21-Jul-12 0:55
trinh.nguyen21-Jul-12 0:55 
AnswerRe: Declare variable as Interface vs. Class Pin
DaveyM6921-Jul-12 1:31
professionalDaveyM6921-Jul-12 1:31 
AnswerRe: Declare variable as Interface vs. Class Pin
Abhinav S21-Jul-12 5:28
Abhinav S21-Jul-12 5:28 
Questionblock data copy from pen drive to PC using c# Pin
haldin20-Jul-12 20:13
haldin20-Jul-12 20:13 
AnswerRe: block data copy from pen drive to PC using c# Pin
Abhinav S20-Jul-12 20:39
Abhinav S20-Jul-12 20:39 
AnswerRe: block data copy from pen drive to PC using c# Pin
Eddy Vluggen21-Jul-12 8:04
professionalEddy Vluggen21-Jul-12 8:04 
QuestionInvalid argument (Converted from VB.Net) Pin
Midnight Ahri20-Jul-12 17:12
Midnight Ahri20-Jul-12 17:12 
GeneralRe: Invalid argument (Converted from VB.Net) Pin
Wes Aday20-Jul-12 17:51
professionalWes Aday20-Jul-12 17:51 
AnswerRe: Invalid argument (Converted from VB.Net) Pin
Midnight Ahri20-Jul-12 19:00
Midnight Ahri20-Jul-12 19:00 
GeneralRe: Invalid argument (Converted from VB.Net) Pin
Dave Kreskowiak21-Jul-12 3:13
mveDave Kreskowiak21-Jul-12 3:13 
QuestionSelecting thread from multiples Pin
MAW3020-Jul-12 15:54
MAW3020-Jul-12 15:54 
AnswerRe: Selecting thread from multiples Pin
Richard MacCutchan20-Jul-12 22:35
mveRichard MacCutchan20-Jul-12 22:35 
QuestionRe: Backgroundworker Thread Issue Pin
munishk20-Jul-12 6:50
munishk20-Jul-12 6:50 
AnswerRe: Backgroundworker Thread Issue Pin
Ian Shlasko20-Jul-12 7:39
Ian Shlasko20-Jul-12 7:39 
AnswerMessage Closed Pin
20-Jul-12 7:56
WebMaster20-Jul-12 7:56 
GeneralRe: Backgroundworker Thread Issue Pin
munishk21-Jul-12 3:50
munishk21-Jul-12 3:50 
AnswerRe: Backgroundworker Thread Issue Pin
DaveyM6920-Jul-12 7:56
professionalDaveyM6920-Jul-12 7:56 
AnswerRe: Backgroundworker Thread Issue Pin
Sunil P V20-Jul-12 20:33
Sunil P V20-Jul-12 20:33 
GeneralRe: Backgroundworker Thread Issue Pin
munishk21-Jul-12 3:50
munishk21-Jul-12 3:50 
GeneralRe: Backgroundworker Thread Issue Pin
Sunil P V21-Jul-12 18:51
Sunil P V21-Jul-12 18:51 
Hey munishk,
I had developed and application that created approximate of 20 Background workers. All these workers had to update progressbars embedded in a listview for around 20 listview items. However, initially the DoWork event handler used to update the UI which made the UI very sloppy and was sometimes showing a hung behavior. I changed the implementation to make use of Delegates to update the UI and by calling the BeginInvoke method this issue got resolved.

C#
// declare a delegate to update your progress
void delegate UpdateProgressDelegate(object params);

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
      //Do Intensive Work
      ArgumentClass backGroundCls = e.Argument as ArgumentClass;
 
      //Now you can do whatever you want to do with passed arguments

      int ctr=0;
      do
      {
          ctr++;
          UpdateProgressDelegate del = new UpdateProgressDelegate(UpdateProgress);
          del.BeginInvoke(ctr, null, null);
      } while (ctr < 10000000);
}

private void UpdateProgress(int ctr)
{
    // update progress here
}


This should definitely work and solve your issue.
Sunil

QuestionProblem with Math.Tan Function Pin
computerpublic20-Jul-12 6:12
computerpublic20-Jul-12 6:12 
AnswerRe: Problem with Math.Tan Function Pin
BobJanova20-Jul-12 6:20
BobJanova20-Jul-12 6:20 
GeneralRe: Problem with Math.Tan Function Pin
computerpublic20-Jul-12 6:22
computerpublic20-Jul-12 6:22 
GeneralRe: Problem with Math.Tan Function Pin
computerpublic20-Jul-12 6:30
computerpublic20-Jul-12 6:30 

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.