Click here to Skip to main content
15,915,336 members
Home / Discussions / C#
   

C#

 
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 
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 
If I could add one more little question onto the above, which I got to work. I also have a C_Comm.cs class which is referenced in my CR5.cs, the original PC.cs, and iCR.cs. It turns out that one area I need to update my progress bar (in PC.cs) from is C_Comm, which is also in a different VS project. I'm trying to get it working, and am getting an error: Cannot implicitly convert type 'ProgressChangeHandler' to C_Comm.ProgressChangeHandler'

Right now it looks like this:

PC.cs (the form code)
public event ProgressChangeHandler ProgressChanged;

public void GetPC(...)
{
   cr.ProgressChanged += new ProgressChangeHandler(updateProgressBar); //cr is instance of CR5 through iCR interface/factory
   cb.ProgressChanged += new ProgressChangeHandler(updateProgressBar); //cb is C_Comm 
}

public int updateProgressBar(int i)
{
    pb.Value = i;
}


iCR.cs (interface)
public delegate void ProgressChangeHandler(int progress);
public interface iCR
{
    event ProgressChangeHandler ProgressChanged;
}


CR5.cs (implements iCR)
public event ProgressChangeHandler ProgressChanged;
private int AttemptWrites()
{
   for(i=0...)
   {
        RaiseProgressChange(i);
   }
}

private void RaiseProgressChange(int progress)
{
    if (ProgressChanged != null)
    {
         ProgressChanged(progress);
    }
}


C_Comm.cs
public delegate void ProgressChangeHandler(int progress);

public class C_Comm{
    public event ProgressChangeHandler ProgressChanged;

    public int Read(byte[] data, int ind)
    {
        for(int i...)
        {
            RaiseProgressChange(i);
        }
    }

    private void RaiseProgressChange(int progress)
    {
        if (ProgressChanged != null)
        {
            ProgressChanged(progress);
        }
    }
}  


Do you know how I could get the ProgressBar in PC.cs to be updated also from C_Comm.cs?
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 
GeneralRe: How to update progressBar from another class Pin
MichCl18-Jan-13 7:16
MichCl18-Jan-13 7:16 
GeneralRe: How to update progressBar from another class Pin
Jibesh18-Jan-13 13:55
professionalJibesh18-Jan-13 13:55 
GeneralRe: How to update progressBar from another class Pin
MichCl21-Jan-13 4:53
MichCl21-Jan-13 4:53 
GeneralRe: How to update progressBar from another class Pin
Jibesh21-Jan-13 5:00
professionalJibesh21-Jan-13 5:00 
GeneralRe: How to update progressBar from another class Pin
MichCl21-Jan-13 5:01
MichCl21-Jan-13 5:01 
GeneralRe: How to update progressBar from another class Pin
Jibesh21-Jan-13 5:02
professionalJibesh21-Jan-13 5:02 
GeneralRe: How to update progressBar from another class Pin
MichCl6-May-13 3:44
MichCl6-May-13 3:44 
QuestionIncluding a PDF file in SHFB generated .chm (Html Helpfile 1) Pin
User 971917715-Jan-13 1:07
User 971917715-Jan-13 1:07 
AnswerRe: Including a PDF file in SHFB generated .chm (Html Helpfile 1) Pin
Pete O'Hanlon15-Jan-13 3:28
mvePete O'Hanlon15-Jan-13 3:28 
QuestionDirectX9 Pin
electriac15-Jan-13 0:20
electriac15-Jan-13 0:20 
AnswerRe: DirectX9 Pin
markovl15-Jan-13 0:53
markovl15-Jan-13 0:53 

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.