Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Hex in VB

  • 12-01-2004 6:09pm
    #1
    Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭


    Hey guyz,

    I'm using the MSComm component in VB for communication with a serial device. The serial device operates on hex commands. I've tried adding a text field to my app. and directly writing in the hex commands. The problem is when I enter the following hex value:

    010A00000000020108F7

    VB sees this as a string and not a series of hex values. Does anyone know how to convert from the Hex string to the actual hex value in VB

    Any help appreciated,
    thanks


Comments

  • Registered Users, Registered Users 2 Posts: 79 ✭✭tendofan


    Maybe you need to Dim a string and each hex byte you want to send, you need to convert it to a character and add it to the string.

    Dim sCommand as String

    'To put the command 01 0A 00 into the string..

    sCommand = sCommand & Chr(&H01)
    sCommand = sCommand & Chr(&H0A)
    sCommand = sCommand & Chr(&H00)

    then set the data for the comm control to sCommand.

    Tendofan


  • Closed Accounts Posts: 4 Scof


    Are you using VB6?

    The Hex$ function should do what your after...


Advertisement