ConvertDataTypes.comConvert data types programming in one click !

Convert Long to Byte() in VB

    18772 hits
  • Dim vIn As Long
  • vIn = -2147483648#
  • 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