DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: binaryto hex

  1. #1
    john Guest

    binaryto hex

    How would I go about converting string of binary data to hexidecimal data?

  2. #2
    Dick Grier Guest

    Re: binaryto hex


    Loop through the string to convert each character to a byte. For example,

    Dim I As Integer
    For I = 1 to Len(Buffer)
    Debug.Print Hex$(Asc(Mid$(Buffer, I, 1)))
    Next I

    Of course, all this does is to display the hex value. You would eliminate
    the Hex$ function to simply use each value. If the data have some sort of
    structure, you have to modify the routine to recognize that structure.

    Richard Grier (Microsoft Visual Basic MVP)
    Hard & Software
    12962 West Louisiana Avenue
    Lakewood, CO 80228
    303-986-2179 (voice)
    303-986-3143 (fax)
    Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
    Edition ISBN 1-890422-25-8 (355 pages).
    For information look on my homepage at http://www.hardandsoftware.net.
    Use the Books link to order. For faster service contact the publisher at

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.