Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I send a hex string to a printer in VB?

Status
Not open for further replies.

Darrenzo

Technical User
May 29, 2003
35
0
0
GB
Hi

This is probably a really dumb question.
Does anyone know how to send a Hex string to a printer (LPT1) in visual basic?
I have the hex string saved as a file (created using a hex editor). I intend to use it to send a control command to the printer to open a cash drawer connected to it.
If I just copy the Hex file to LPT1 then the drawer opens ok. But I want to be able to do this from within VB.
I am a novice VB user.

All help appreciated!

:eek:]
 
Will this work:

Code:
Open "LPT1:" For Output as #1
Print "Your hex string"
Close #1
 
I managed to get it to work. It was embarrassingly easy. here is the code in case it helps other novices like me! :eek:]

The string i needed to send (to pop a cash drawer open using an Epson TM-T88iii receipt printer) was (in decimal): 27,112,48,50,250

Dim myHex As String

myHex = Hex(27) & Hex(112) & Hex(48) & Hex(50) & Hex(250)
Printer.Print myHex
Printer.EndDoc


Thanks to Bjd4jc for replying.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top