• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1625
  • Last Modified:

Command for POS Display

I can't get proper output on my POS Pole Display using my Visual Basic

In QBasic, I type
      Open "COM1:9600,N,8,1" for output as #1
      Print #1, Chr$(12)
      Print #1, "123456789"
It would clear screen and add the string on display

but in Visual Basic, when I type
      Open "COM1" for output as #1
      Print #1, Chr$(12)
      Print #1, "123456789"
      Close #1
it comes out only unknown symbols.

Is there any mistake on the VB Coding? I was to execute the code in Hex    1B 51 41 n OD  to write string n to the upper line.

1 Solution
IN VB you do not use COM1 to communicate with the serial port; rather; you use Micorosft COMM control.

You add the values: "9600,N,8,1" in the settings property;

This example is taken from the help:

Private Sub Form_Load()
   ' Buffer to hold input string
   Dim Instring As String
   ' Use COM1.
   MSComm1.CommPort = 1
   ' 9600 baud, no parity, 8 data, and 1 stop bit.
   MSComm1.Settings = "9600,N,8,1"
   ' Tell the control to read entire buffer when Input
   ' is used.
   MSComm1.InputLen = 0
   ' Open the port.
   MSComm1.PortOpen = True
   ' Send the attention command to the modem.
   MSComm1.Output = "ATV1Q0" & Chr$(13) ' Ensure that
   ' the modem responds with "OK".
   ' Wait for data to come back to the serial port.
   Buffer$ = Buffer$ & MSComm1.Input
   Loop Until InStr(Buffer$, "OK" & vbCrLf)
   ' Read the "OK" response data in the serial port.
   ' Close the serial port.
   MSComm1.PortOpen = False
End Sub

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now