|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:
Form with progressBar displayed
private int writeIt(ref byte wDat, byte sDat)
result = cr.ProcessTWriting(ref wDat, ref pb_Progress.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):
public int ProcessTWriting(ref byte WDat, ref int pb_value)
status = AttemptWrites(ref pb_value);
And the method it calls:
private int AttemptWrites(ref int pb_value)
for (int i = 0; i < ((wDat.Length) / 4); i++)
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:
Hopefully it's not TMI, but I figure, the more info the better so people can see where I'm coming from.