ConvertDataTypes.comConvert data types programming in one click !

Convert Integer to Byte() in VB

    18976 hits
  • Dim vIn As Integer
  • vIn = -32768
  • Dim vOut((LenB(vIn) - 1)) As Byte
  • For i = 0 To (LenB(vIn) - 1)
  • vOut(i) = (Int(vIn / (2 ^ (8 * (LenB(vIn) - 1 - i))))) And ((2 ^ 8) - 1)
  • Next i