2
Answers

simple conversion

Ehab Saleh

Ehab Saleh

16y
5k
1
Hi, I am new to C#.. I want to convert a byte or int to string or text. I have a byte with value 130, I just want to show it in a textBox or a label. If I try to do it directly, like: txtDataReceived.Text = myDataByte; then I get the obvious error: (Cannot implicitly convert type 'byte' to 'string') I thought it will be very simple.. any idea how to sort it out. Thanks
Answers (2)
0
Ehab Saleh

Ehab Saleh

NA 3 0 15y
Cheers mate,, I get error normally in trying those methods,, Anyways,, I sorted it out in a funny way,, I just did: myChar = "" + myInt; So the complier took the "" which is just an empty char and added the integer into it. Thanks again anyway
0
Sateesh Arveti

Sateesh Arveti

NA 24k 6.2m 16y
Hi,

Use .ToString() method on the byte variable (or) Convert.ToString(byte variable)