Click here to Skip to main content
15,890,438 members
Home / Discussions / C#
   

C#

 
QuestionAdd a dll reference from another server. Pin
vanikanc15-Jan-13 9:55
vanikanc15-Jan-13 9:55 
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 
I have a form with a progressBar on it. I'm doing writes in another class (through my interface) and need to show my progress of doing the writes, but I'm getting an error message *. Hopefully someone has an idea how to get the error to go away and so I can update my progressBar from a different class.

I'm more of a C++ developer doing C#, so there might be something that an experienced C# person would know of that I'm missing.

It looks like this:

PC.cs [Design]
Form with progressBar displayed

PC.cs
C#
private int writeIt(ref byte[] wDat, byte[] sDat)
{
     result = cr.ProcessTWriting(ref wDat, ref pb_Progress.Value); //this passes a ref to the progressBar value
}


* In the code above, I'm getting "A property, indexer or dynamic member access may not be passed as an out or ref parameter" error message.

My interface looks like this:

iCR.cs (which is in another VS project due to future CR6, etc. which will use the interface)
int ProcessTWriting(ref byte[] wDat, ref int pb_value);


Then, I want to pass my references (to progressBar value) to where I'm writing my bytes (i to 1024), and update the reference to the progressBar as it iterates through, writing to it's destination.

This would be in my CR5.cs which implements iCR.cs (and is in another VS project still...think Factory pattern):
C#
public int ProcessTWriting(ref byte[] WDat, ref int pb_value)
{
        status = AttemptWrites(ref pb_value);
}              


And the method it calls:
C#
private int AttemptWrites(ref int pb_value)
{
     for (int i = 0; i < ((wDat.Length) / 4); i++)
     {
        //as it does writes, I want to set pb_value here to % complete
     }
}


Does anyone have a suggestion how to get my progressBar to update as I iterate through each byte I'm writing in my other class? I've looked at a couple of similar situations and there do seem to be people passing an index of an array, but I'm having trouble figuring out how to apply them to my situation. If I assign pb_value to a temporary value, passing it as a reference, it won't update my progressBar.Value as I do my writes and update the temporary reference to the value. Here's the links I found on the topic:
http://stackoverflow.com/questions/4813289/a-property-indexer-or-dynamic-member-access-may-not-be-passed-as-an-out-or-ref[^]
http://stackoverflow.com/questions/12440013/a-property-indexer-or-dynamic-member-access-may-not-be-passed-as-an-out-or-ref[^]
http://stackoverflow.com/questions/4518956/a-property-or-indexer-may-not-be-passed-as-an-out-or-ref-parameter[^]
http://stackoverflow.com/questions/6492097/a-property-indexer-or-dynamic-member-access-may-not-be-passed-as-an-out-or-ref[^]

Hopefully it's not TMI, but I figure, the more info the better so people can see where I'm coming from.
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 
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 

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.