[RESOLVED] Open Cash Drawer
Hello, I need help, can anyone help me?
I want to open a cash drawer using VB.NET code, but I can't find the proper code. I use EPSON Printer TM-U220, and it's connected to a drawer; the printer itself is connected to the computer using COM port.
I notice the following code works well in VB:
Code:
Printer.FontName = "control"
Printer.Print "A"
Printer.EndDoc
Unfortunately, there's no Printer object in VS 2005, substituted by PrintDocument, but can't find some properties in it.
I found this code, using VB.NET, but it's using LPT1, not COM1. I tried replacing LPT1 with COM1, but failed.
Code:
Dim intFileNo As Integer = FreeFile()
FileOpen(1, "c:\escapes.txt", OpenMode.Output)
PrintLine(1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250))
FileClose(1)
Shell("print /d:LPT1 c:\escapes.txt", vbNormalFocus)
Any help would be appreciated.
Thanx
1 Attachment(s)
Re: [RESOLVED] Open Cash Drawer
i have tried to code above but the poblem is it doesnt print.. the open.txt file is corrupt.. the content become like this
Attachment 93613
Re: [RESOLVED] Open Cash Drawer
The problem with this code is when it prints the open.txt, in only open the cash drawer after printing.. can they both execute on the same time? How?
Code:
FileOpen(1, AppDomain.CurrentDomain.BaseDirectory & "open.txt", OpenMode.Output)
PrintLine(1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250))
FileClose(1)
Shell("print /d:com1 open.txt", AppWinStyle.Hide)