CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    25

    How can Shift a Hex value in VB.

    Dear all,


    I have a Hex value. I want to shift the Hex value to left 4 position. How I can do it? .. Is any function avialable ?

    Regards,
    Kareem.


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: How can Shift a Hex value in VB.

    try this (I got this from "Crazy D @ work"

    private Function LShiftWord(byval w as Integer, byval c as Integer) as Integer
    Dim dw as Long
    dw = w * (2 ^ c)
    If dw And &H8000& then
    LShiftWord = CInt(dw And &H7FFF&) Or &H8000
    else
    LShiftWord = dw And &HFFFF&
    End If
    End Function





  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: A bit Of Knowledge From Past





    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: How can Shift a Hex value in VB.

    Shifting to the left acts as a multiplier and to the right divides.
    If you myltiply by 16 you will shift 1 position. Multiply (or divide) as many times as possible). I think it should work

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured