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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET newbie - printing/writing to LPT port

Status
Not open for further replies.

zarkon4

MIS
Dec 16, 2003
641
US

I am creating an app to print bar code labels to a label printer and need to print/write directly to the lpt port
the below code is in VB 6, and I need to create this in VB.NET 2005.

Open "LPT1:" For Output As #1
Print #1, _
"^XA^MMC^MNN^MTT^PON^PMN^JMA^PR4,4^JUS^CI0^XZ"
Print #1, "^XA"
Print #1, "^LH0,0^LL" & lYLabelLen

Print #1, "^BY2,3,70^FT425," & lYBarCode & _
"^B3N,N,,N,N"
Print #1, "^FD" & "9999" & "^FS"
Print #1, "^FO400," & lYText1 & "^A0N25,25"
Print #1, "^FD" & "CALIBRATION" & "^FS"
Print #1, "^FO665," & lYText2 & "^A0N25,25"
Print #1, "^FD" & "9999" & "^FS"

'Next label is 250 added to y
lYBarCode = lYBarCode + 250
lYText1 = lYText1 + 250
lYText2 = lYText2 + 250

Print #1, "^XZ"
Close #1

I did run across this
FileOpen(1, "LPT" & CStr(portnum), OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.LockReadWrite, -1)
but am now confused on how to print/write to it.

Can anyone point me in the right direction?

Thanks in advance!
 
Never mind, I found it

FileOpen(1, "LPT1:", OpenMode.Output)
PrintLine(1, "^XA^MMC^MNN^MTT^PON^PMN^JMA^PR4,4^JUS^CI0^XZ")
PrintLine(1, "^XA")
PrintLine(1, "^LH0,0^LL" & lYLabelLen).....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top