?
Solved

Command for POS Display

Posted on 2003-03-28
1
Medium Priority
?
1,539 Views
Last Modified: 2008-02-01
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"
      Close
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.

0
Comment
Question by:Bismacom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
emadat earned 300 total points
ID: 8226830
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.
   Do
      DoEvents
   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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question