Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 27th, 2012  |  syntax: None  |  size: 1.21 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Public Sub Imprimir_ZPL_COM(ByVal cadena As String, ByVal PORT As String)
  2.         Dim xlb As String
  3.         Try
  4.             Dim puerta_serial As System.IO.Ports.SerialPort
  5.             puerta_serial = New System.IO.Ports.SerialPort
  6.             puerta_serial.PortName = PORT
  7.             puerta_serial.BaudRate = 9600
  8.             puerta_serial.DataBits = 8
  9.             puerta_serial.Parity = IO.Ports.Parity.None
  10.             puerta_serial.StopBits = IO.Ports.StopBits.One
  11.             puerta_serial.WriteTimeout = 4000
  12.  
  13.             If puerta_serial.IsOpen Then
  14.                 puerta_serial.Close()
  15.             End If
  16.             puerta_serial.Open()
  17.  
  18.  
  19.             xlb = "^XA^PRC^LH0,0^FS^LL416^MD0^MNY^LH0,0^FS" '  Encabezado
  20.             '380
  21.             xlb = xlb & "^BY2,2.0^FO323,100^BCN,100,Y,N,N^FR^FD>" & cadena & "^FS" ' Imprime codigo de barras
  22.  
  23.  
  24.             xlb = xlb & "^PQ1^XZ"
  25.             xlb = Replace(xlb, "Ñ", Chr(165))
  26.             xlb = Replace(xlb, "ñ", Chr(164))
  27.  
  28.             puerta_serial.WriteLine(xlb)
  29.             puerta_serial.Close()
  30.  
  31.         Catch ex As IO.IOException
  32.             MessageBox.Show("Erro::" & ex.Message, "ERRO", MessageBoxButtons.OK)
  33.  
  34.         End Try
  35.     End Sub