[Solved] Display byte array in textbox [closed]


The equivalent C# of your last line is:

TextBox1.Text = String.Join("", Array.ConvertAll(bArr, byteValue => byteValue.ToString()));

You replace the anonymous function with a lambda expression (byteValue => byteValue.ToString())

As I noted in my comment, this will print the decimal values of the bytes, so 0x00 will be printed as 1, and 0xFF will be printed as 255.

For example 0x00, 0x20, 0xFF will be printed as 035255. This may not be what you want. Certain combinations of bytes could result in the same printed text. I’d recommend using hexadecimal instead as this will print 2 characters for every byte, instead of 1-3 characters for every byte.

For example, you could output hexadecimal like so:

TextBox1.Text = BitConverter.ToString(bArr).Replace("-", "");

This would output the above example as 0020FF.

solved Display byte array in textbox [closed]