Serial Port Visual Basic 6

  1. Reading/Writing data via COM Port in VB6. Ask Question 0. I am working with a laboratory machine (cobas 6000) to implement LIS using VB6. The machine has a COM port (9 pin). Browse other questions tagged vb6 serial-port or ask your own question. 5 years, 6 months ago. 21,185 times. 4 years, 2 months ago.
  2. Using an ASP page to send data out the serial port. Compatible RS-232 Serial device. Microsoft Visual Basic 6.0 or later (to view, modify and recompile project files) Internet Explorer 4.0 or later (recommended) or other Windows compatible Web Browser.
  3. I'm not much experienced in VB6 serial port programming. I need to control another circuit through serial port. (I have heard that pin 4 and pin 7 are used for that purpose. Richard Grier's Visual Basic Programmer's Guide to Serial Communications is a good book that covers VB6 (and VB.Net): it's available from his website.
  4. How to manipulate binary data recieved via a serial port - VB6 Visual Basic 6.0 I've searched the forum and although some threads come close, none answer my question.
Serial Port Visual Basic 6
ActiveXperts » Serial Port Component » How to Use Serial Port Component » Visual Basic .NET

Cybera is written in Visual Basic 6 and needs to be ported to Visual Basic.NET to get ready for the future. The first step is to port the Cybera client to.NET. In the second step the Cybera server will be ported. There will be no new features in the first two steps. Simple parallel/serial port programming (Visual Basic 6.0). With the serial port standard, a -5 volts is a 1, a +5 volts is 0. There appears to be one here written by the guy who wrote a. Hello folks, Visual Basic.net is an easy to learn language from Microsoft for the windows platform.One of the cool features of Visual Basic.net is the ability to whip up good looking gui components with a few lines of code. In this tutorial we are going to use Visual Basic.net to program your PC's Serial Port and communicate with an embedded microcontroller like MSP430 or 8051.

ActiveXperts Serial Port Component is a software development kit (SDK) that enables the user to communicate to a device over a serial interface.

Such a device can be: a weight indicator, a modem, a scanner, or any other device that is equiped with a serial port. It can even be another PC, connected via a NULL modem cable.

Serial Port Visual Basic 6

ActiveXperts Serial Port Component features the following:

  • Direct COM port support (like 'COM1')
  • TAPI (Windows Telephony Device) support (like 'Standard 56000 bps Modem');
  • Support for RS-232/RS422/RS485, up to 256 simultaneous ports;
  • Support for all types of Hayes compatible modems;
  • Support for serial cable as well as USB cable or Bluetooth connections;
  • Support for Virtual COM ports (i.e. COM ports redirected through the network);
  • Hardware flow control (RTS/CTS, DTR/DSR) and software flowcontrol (XON/XOFF) support;
  • Configurable baudrate/parity/stopbits, full buffered data transfer, text/binary data transfer.

Serial Port Component can be well integrated into .NET environments.

This document describes how the ActiveXperts Serial Port Component can be integrated into into Visual Basic .NET projects.

Step 1: Download and install the ActiveXperts Serial Port Component

Download the the ActiveXperts Serial Port Component from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.

Step 2: Create a new Visual Basic .NET Project

Launch Microsoft Visual Studio (for instance 'Microsoft Visual Studio 2005') from the Start menu. Choose 'New' from the 'File' menu and click on 'Project'. In the 'New Project' dialog, select a Visual Studio template (for instance: 'Console Application'). Select a name for the application (for instance: 'DemoApp') and a name for the solution (for instance: 'DemoSolution'). Also, select the directory where you want to store the project (for instance: 'C:MyProjects):

Step 3: Refer to the ActiveXperts Serial Port Component Library and create the objects

Now that a new project has been created, you must add a reference to the ActiveXperts Serial Port Component in the project to be able to use the the ActiveXperts Serial Port Component object. To do so, choose 'Add Reference...' from the 'Project' menu. In the 'Add Reference' dialog that pops up, select the 'COM' tab and select the 'Serial Port Component 2.2 Type Library' as shown in the following picture:

(Click on the picture to enlarge)

Click 'OK' to close the 'Add Reference' dialog.

On top of your code, type the following line to use the ActiveXperts Serial Port Component namespace:

Visual basic 6 serial port programming

In your Main function, declare and create the following object:

Step 4: Send an AT command to a connected Hayes compatible modem

You can now send and receive data to and from a serial interface.

The following code shows how to query a modem:

There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/serial-port-component.

-->

This topic describes how to use My.Computer.Ports to receive strings from the computer's serial ports in Visual Basic.

To receive strings from the serial port

  1. Initialize the return string.

  2. Determine which serial port should provide the strings. This example assumes it is COM1.

  3. Use the My.Computer.Ports.OpenSerialPort method to obtain a reference to the port. For more information, see OpenSerialPort.

    The Try...Catch...Finally block allows the application to close the serial port even if it generates an exception. All code that manipulates the serial port should appear within this block.

  4. Create a Do loop for reading lines of text until no more lines are available.

  5. Use the ReadLine() method to read the next available line of text from the serial port.

  6. Use an If statement to determine if the ReadLine() method returns Nothing (which means no more text is available). If it does return Nothing, exit the Do loop.

  7. Add an Else block to the If statement to handle the case if the string is actually read. The block appends the string from the serial port to the return string.

  8. Return the string.

Example

This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Connectivity and Networking. For more information, see Code Snippets.

Serial Port Visual Basic 6 Download

Compiling the Code

This example assumes the computer is using COM1.

Robust Programming

This example assumes the computer is using COM1. For more flexibility, the code should allow the user to select the desired serial port from a list of available ports. For more information, see How to: Show Available Serial Ports.

Serial Port Visual Basic 6 7

This example uses a Try...Catch...Finally block to make sure that the application closes the port and to catch any timeout exceptions. For more information, see Try...Catch...Finally Statement.

Visual Basic Serial Communication

See also