Thanks guys. after looking into it after what you said i noticed C# strips
the extra bits to make it a byte and VB does not. VB makes you do the
striping yourself.
for example:
int 360 converted to bits is 101101000 (has one extra bit)
when i convert to a byte in C# i get 01101000 which is 8 bits and equals 104
VB.NET simply doesn't do it. you have to convert it into a byte array using
System.BitConverter and select the first element or write a procedure to
strip the extra bits.
cheers!
-king
"chanmm" <ch*****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
I am surprised why VB.NET not 104. Basically a byte is only 8 bit so the
maximum number it can handle only 265. 104 is basically 306 - 256 = 104.
chanmm
"news.microsoft.com" <ms**@precisionport.comwrote in message
news:On**************@TK2MSFTNGP03.phx.gbl...
Hello,
I'm a VB.NET guy converting a C# app to VB.NET and ran into an issue.
Steping through both the C# and VB.NET apps i get identical results but
for
one section.
Notes: bit_buffer = 360 and bArray is an array of bytes going into these
lines of code
**********
(C#):
"bArray[i] = (byte)bit_buffer;"
End result: bArray[i] = 104
(VB.NET):
bArray(i) = CByte(bit_buffer)
End Result: Overflow because 360 can't fit into a byte of max 255
***********
My question is why does the C# version convert it into a byte value of
104
when the VB one doesn't??
Thanks in advance!