Sample code for VB.net to print to zt230 via usb

J John Lee 3 years 7 months ago
1345 2 0

Do you have an updated version of the sample code on the link:
https://support.zebra.com/cpws/docs/zpl/zpl_elp_vbnet.htm

The following lines of code no longer work. The FileStream now needs a SaveFileHandle instead of
a the file handle created by the CreateFile (this is what is reported by VS2008.)

hPort = CreateFile(LPTPORT, GENERIC_WRITE, FILE_SHARE_WRITE, SA, OPEN_EXISTING, 0, 0)
hPortP = New IntPtr(hPort) 'convert Integer to IntPtr
outFile = New FileStream(hPortP, FileAccess.Write, False) 'Create FileStream using Handle

I can not figure out how to correct the sample code in the link but it is exactly what I need to do. I need to write
the ZPL directly to the printer. We have a ZT230/USB and it is installed and working with ZebraDesigner. I just
need to learn how to send the ZPL from my VB.Net app. I would imagine this is a very common requirement, so any samples would
be greatly appreciated. I need to also mention that I must work in .Net version 2-3 due to other limitations in the application.

Thanks,
John

Please Register or Login to post a reply

2 Replies

a adilakshmi Bachina

Can anyone have sample code for Printing zpl commands to print to zp550 via usb

J John Lee

Someone mentioned using the SDK. Is it compatible with VS2008, x86 and .Net 3.5?
This seems such an simple request and I would think Zebra would want to make it easy for developers to embed their printers in projects so why not a simple Hello World example?

CONTACT
Can’t find what you’re looking for?