Solved

VB & COM Ports...

Posted on 1998-06-28
1
190 Views
Last Modified: 2010-05-03
Well... it's quite simple... the question:

DOS:    echo babykins > com1
VB4.0:  ????

I need to tell VB to echo a command to the comport (The command is only a text string:  babykins)
0
Comment
Question by:coolcole
1 Comment
 
LVL 1

Accepted Solution

by:
khaledc earned 50 total points
Comment Utility
Have a you had a look at  MSComm Control, it deals with serial communication.
If you are after semding a string over com1 then, first you should include the MSComm Control (from the Components list of VB), then you could write something like this :
' 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 = "AT" + Chr$(13)
      ' Wait for data to come back to the serial port.

Do
            DoEvents
      Loop Until MSComm1.InBufferCount >= 2
      ' Read the "OK" response data in the serial port.
      Instring = MSComm1.Input
      ' Close the serial port.
      MSComm1.PortOpen = False

Hope that could help
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Share codes 68 114
Controlling which port to download from 4 57
DIR issue 7 45
MS Access - Capture pressed key onclick 4 20
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now