?
Solved

vb help

Posted on 1998-06-26
1
Medium Priority
?
139 Views
Last Modified: 2010-05-03
This seems like a really easy question, but could somebody help me.  I am trying to communicate with a serial comm port through visual basic and I don't know the commands to use to open the port or to send a simple string command to an external module,
                 Thanks,  
 
0
Comment
Question by:maddux
[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 6

Accepted Solution

by:
clifABB earned 200 total points
ID: 1464433
You should use the MSComm control.
The following simple example shows basic serial communications using a modem:
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 = "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
End Sub


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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
Course of the Month10 days, 4 hours left to enroll

762 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