0

I am trying to make a function that supports 4 parameters, but it does not work.. How I can resolve this ? Thank you.

private void Byte(byte a, byte b, uint c, byte d)
{
     PS3.SetMemory(a + b * c, new byte[] { d });
}

Byte(0x00f474e3 + 0x3700 * dataGridView1.CurrentRow.Index, new byte[] { 0x03 });

Error:

Error: No overload for 'Byte' method takes two arguments
3
  • 1
    Error message isn't clear? Your Byte method takes 4 parameter but you try to call it with 2 arguments. One with (0x00f474e3 + 0x3700 * dataGridView1.CurrentRow.Index and another is new byte[] { 0x03 } Commented Apr 20, 2014 at 10:57
  • well your second parameter is a NON byte array but you are trying to pass a byte array. furthermore your 3rd and 4th parameter are not specified. Commented Apr 20, 2014 at 10:57
  • And in addition: of course a byte[] is not a byte. Commented Apr 20, 2014 at 10:58

3 Answers 3

5

You dont need to perform the calculations while sending the parameters.

I Think you wanted to do this:

Byte(0x00f474e3,0x3700 , dataGridView1.CurrentRow.Index , 0x03);

OR

You can simply avoid Byte() function by wrting asbelow:

PS3.SetMemory(0x00f474e3 + 0x3700 * dataGridView1.CurrentRow.Index, 
                                                            new byte[] { 0x03 });
Sign up to request clarification or add additional context in comments.

Comments

1

The error says it all.

Yes. You're not specifying c and d.

0x00f474e3 + 0x3700 * dataGridView1.CurrentRow.Index is a

while

new byte[] { 0x03 } is b, which is wrong. It doesn't expect byte array but just byte.

What about c, d?

So, I think you should do:

Byte(0x00f474e3,0x3700,dataGridView1.CurrentRow.Index,0x03);

Comments

1

You should pass parameters as is:

Byte(0x00f474e3, 0x3700, dataGridView1.CurrentRow.Index, 0x03);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.