kdb279: VB Port Test – Visual Basic Sample Application

Title: VB Port Test – Visual Basic Sample Application
Date: May 17, 2001
KDB: KDB-279
Revision: 0.00
Author: Chris Dore
Distribution: External

About This KDB:

The Visual Basic (VB) sample application, VB Port Test, is an example of how to open more than 16 serial ports in VB.

The Problem:

The MSComm control that ships with VB will only allow a specified pot number to be in the range of 1 to 16.

This leads to problems for people who wish to use multi-port adapters in VB.

The Solution:

The solution to this problem is to use the Windows Application Programming Interface (API). This allows a programmer to access all of windows standard system calls. This is generally done with C programs however it is also possible to do so in VB.

Information on VB .net is also available as a Microsoft KDB
If you would like some sample source from Microsoft on this please contact Technical Support.

Using the sample application:

Requirements

  1. A copy of the project’s files VBPT100.zip
  2. Microsoft Visual Basic 6 (although 5 could be used, you will have to take extra steps to convert the project’s files).
  3. Knowledge of how to get around and use VB (the more you know the better).
  4. Knowledge of Windows API’s is a definite asset.

Running the sample:

  1. Unzip the project files into some directory.
  2. Open the VBPortTest.vbp project file in VB.
  3. Run it (it should work, if not please email [email protected]).

Compiling the sample to an executable:

  1. Select “Project” Menu → “VBPortTest Properties”
  2. From the “Compile” tab, make sure “Compile to P-Code” is selected. For some unknown reason none of the “Compile to Native Code” options work correctly. If you wish you can try these.
  3. Click “OK”.
  4. Select “File” Menu → “Make VBPortTest.exe…”
  5. Select a destination directory and filename and click “OK”. This should compile and create an executable program file.

End of KDB-279

Go to Top