VB.Net 2003 with Zebra Barcode Printer on Network

G

Guest

How do I print something to a Zebra Barcode Printer that is on a network (IP
address)? The following code generates an error message (Invalid Handle) on
line marked with ***

Dim Texxxt As String
Dim SA As SECURITY_ATTRIBUTES
Dim outFile As FileStream, hPortP As IntPtr
LPTPORT = "111.222.333.444"
Texxxt = Me.RichTextBox1.Text
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
Dim fileWriter As New StreamWriter(outFile)
fileWriter.Write("^NC^")
fileWriter.Write("^XA^")
fileWriter.Write("^FO50,50^A030,30^FD MyTest^FS")
fileWriter.Write(Chr(34))
fileWriter.Write("^FO50,100^A030,30^FD UNITED STATES^FS")
fileWriter.Write("^XZ^")

fileWriter.Write(Chr(13))
fileWriter.Write(Chr(10))
fileWriter.Flush()
fileWriter.Close()
outFile.Close()
retval = CloseHandle(hPort)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top