Click here to Skip to main content
15,913,584 members
Home / Discussions / C#
   

C#

 
AnswerRe: Add a dll reference from another server. Pin
Jibesh15-Jan-13 10:08
professionalJibesh15-Jan-13 10:08 
AnswerRe: Add a dll reference from another server. Pin
Garth J Lancaster15-Jan-13 10:14
professionalGarth J Lancaster15-Jan-13 10:14 
AnswerRe: Add a dll reference from another server. Pin
Abhinav S15-Jan-13 21:42
Abhinav S15-Jan-13 21:42 
QuestionHow to show google zoom bar in my map ? Pin
a1_shay15-Jan-13 8:26
a1_shay15-Jan-13 8:26 
AnswerRe: How to show google zoom bar in my map ? Pin
Pete O'Hanlon15-Jan-13 8:48
mvePete O'Hanlon15-Jan-13 8:48 
QuestionWCF Self-Hosted REST service... how to create OperationContext?? Pin
SledgeHammer0115-Jan-13 7:05
SledgeHammer0115-Jan-13 7:05 
QuestionHow to update progressBar from another class Pin
MichCl15-Jan-13 4:17
MichCl15-Jan-13 4:17 
SuggestionRe: How to update progressBar from another class Pin
HuorSwords15-Jan-13 5:50
HuorSwords15-Jan-13 5:50 
GeneralRe: How to update progressBar from another class Pin
MichCl15-Jan-13 7:47
MichCl15-Jan-13 7:47 
GeneralRe: How to update progressBar from another class Pin
Dave Kreskowiak15-Jan-13 8:03
mveDave Kreskowiak15-Jan-13 8:03 
GeneralRe: How to update progressBar from another class Pin
Jibesh15-Jan-13 8:54
professionalJibesh15-Jan-13 8:54 
GeneralRe: How to update progressBar from another class Pin
MichCl15-Jan-13 9:00
MichCl15-Jan-13 9:00 
GeneralRe: How to update progressBar from another class Pin
Jibesh15-Jan-13 9:09
professionalJibesh15-Jan-13 9:09 
GeneralRe: How to update progressBar from another class Pin
Jibesh15-Jan-13 9:24
professionalJibesh15-Jan-13 9:24 
Ok I will try to explain with your class name

define a event in your interface iCR.cs
C#
public delegate void ProgressChangeHandler(int progress);

interface CRInterface
{
  event ProgressChangeHandler ProgressChanged;
  int ProcessTWriting(ref byte[] WDat, ref int pb_value)
}

Implement this interface in CRD.cs class
C#
class MyCR: CRInterface
{
  public event ProgressChangeHandler ProgressChanged;
  
  public int ProcessTWriting(ref byte[] WDat, ref int pb_value)
  {
    status = AttemptWrites(ref pb_value);
  } 
  
  private int AttemptWrites(ref int pb_value)
  {
     for (int i = 0; i < ((wDat.Length) / 4); i++)
     {
        RaiseProgressChange(i);
        //as it does writes, I want to set pb_value here to % complete
     }
  }
  
   private void RaiseProgressChange(int progress)
   {
     if(ProgressChanged!= null)
     {
       ProgressChanged(progress);
     }
   }
}

Finally Subscribe for event change in your FormClass i.e PC.cs
C#
// call this line just below where you create the instance of CR5 class
private FormLoad(...)
{
  cr.ProgressChanged += new ProgressChangeHandler(CR_ProgressChanged);
}

private void CR_ProgressChanged(int progress)
{
  progressBar.Value = progress;
}

Hope this helps.
Jibesh V P

GeneralRe: How to update progressBar from another class Pin
MichCl15-Jan-13 9:55
MichCl15-Jan-13 9:55 
GeneralRe: How to update progressBar from another class Pin
Jibesh15-Jan-13 10:06
professionalJibesh15-Jan-13 10:06 
GeneralRe: How to update progressBar from another class Pin
MichCl15-Jan-13 10:15
MichCl15-Jan-13 10:15 
GeneralRe: How to update progressBar from another class Pin
Jibesh15-Jan-13 11:34
professionalJibesh15-Jan-13 11:34 
GeneralRe: How to update progressBar from another class Pin
MichCl17-Jan-13 5:18
MichCl17-Jan-13 5:18 
GeneralRe: How to update progressBar from another class Pin
Jibesh17-Jan-13 8:17
professionalJibesh17-Jan-13 8:17 
GeneralRe: How to update progressBar from another class Pin
MichCl17-Jan-13 8:59
MichCl17-Jan-13 8:59 
GeneralRe: How to update progressBar from another class Pin
Jibesh17-Jan-13 9:18
professionalJibesh17-Jan-13 9:18 
GeneralRe: How to update progressBar from another class Pin
MichCl17-Jan-13 9:44
MichCl17-Jan-13 9:44 
GeneralRe: How to update progressBar from another class Pin
Jibesh17-Jan-13 10:24
professionalJibesh17-Jan-13 10:24 
GeneralRe: How to update progressBar from another class Pin
MichCl18-Jan-13 2:07
MichCl18-Jan-13 2:07 

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.