How To Open Cashier Drawer In VB.NET

the code below will open the cashier drawer using either
LPT or COM port

if you use LPT port this is the right way of code


    'Author : Mohamed Shimran
    'Blog : http://www.ultimateprogrammingtutorials.blogspot.com

  Private Sub OpenCashierDrawer()
        Dim intFileNo As Integer = FreeFile()
       
        FileOpen(1, "c:\escapes.txt", OpenMode.Output)
        PrintLine(1, Chr(27) & "p" & Chr(0) & Chr(25) & Chr(250))
        FileClose(1)
 
        Shell("print /d:lpt1 c:\escapes.txt", vbNormalFocus)
 End Sub

if you use com port this is the way

   
 'Author : Mohamed Shimran
    'Blog : http://www.ultimateprogrammingtutorials.blogspot.com

  Private Sub OpenCashierDrawer()
        Dim intFileNo As Integer = FreeFile()
           
        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)
    End Sub

done easy

1 comments:

How this work?
I mean I just need to add this code in the Form and when the form is open it will open the Cash drawer???
Or i need to add the button which will Open/Close the cash drawer???

Reply

Post a Comment

Note: Only a member of this blog may post a comment.