DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Suneera Guest

    Passing Hex values


    He All,

    How can I pass hex values as string into a function.
    For example I want to pass (5A C9 02)(any number of) as a single string,
    where the receiptant is a string variable

    Thanks in advance
    Suneera


  2. #2
    Sam Barrett Guest

    Re: Passing Hex values


    >How can I pass hex values as string into a function.
    >For example I want to pass (5A C9 02)(any number of) as a single string,
    >where the receiptant is a string variable


    Suneera, You can use the hex function to convert a number into a string of
    hexadecimal digits. Hex(5949698) will return the string "5AC902". Hope
    this helps! --Sam

    Sam Barrett, MTL Systems, Inc., mailto:sam@mtl.com
    Brainbench MVP, http://www.brainbench.com

    And the things that you have heard...commit these to faithful
    men who will be able to teach others also. 2 Timothy 2:2



  3. #3
    Bob Butler Guest

    Re: Passing Hex values


    "Suneera" <suneera77@yahoo.com> wrote in message
    news:3ae3c417$1@news.devx.com...
    >
    > He All,
    >
    > How can I pass hex values as string into a function.
    > For example I want to pass (5A C9 02)(any number of) as a single string,
    > where the receiptant is a string variable


    If I understand correctly...

    Dim s As String
    s=Chr$(CLng("&H5A")) & Chr$(CLng("&HC9")) & Chr$(CLng("&H02")) ...
    Call MySub(s)

    If you have control over the called routine I'd suggest changing it to a
    byte array instead. Strings in VB are stored as unicode so you are
    converting ascii->unicode->ascii and that slows things down and can lead to
    some strange issues like:
    If chr$(130)<chr$(255) Then Msgbox "you never get to this!"




Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links