Serial Port Tool focuses on COM Port communication software for RS232 related works.
How to use Visual Basic 2008 for R8X

Visual Basic is our preferred language for communicating to the NCD product line. Visual Basic 2008 is an evolution of the Visual Basic language that is engineered for productively building type-safe and object-oriented applications.The Visual Basic 2008 Express Edtion is free download from Microsoft. If you are a programmer of VB6 or VB2005, it is easy to switch to Visual Basic 2008.

The following guide will teach ANYONE how to operate ANY of our products using Visual Basic 2008 Express Edition. The example provided on this page is developed for Visual Basic 2008 Express Edition. These directions are about 99% compatible with other VS2005 edition which include VB. Following these simple steps and you will be on your way to control ANYTHING from your desktop computer in 30 minutes or less.

If you have questions, please contact us.

 

Step 1: Create a New Project
  • From the Windows Start menu, choose Microsoft Visual Basic 2008 Express Edition.
  • The following screen appears.

 

  • On the File menu, click NewProject.

  • The New Project dialog box opens as below.
  •  Select Windows Application .
  • Input project Name.

  • Click "OK" to get the project window.

Step 2: Add Serialport Control to the Project
  • Open Toolbox window. (The Toolbox is on the left side of Visual Basic 2008. You can keep it open by clicking the Auto Hide icon, which looks like a push pin.)
  • Find SerialPort control on the Components of Toolbox.
  • Drag SerialPort control into frame Form1 to add SerialPort1.

 

Step 3: Add Button to the Project
  • Drag Button control into frame Form1 to add Button1 and Button2.

  • Select Button1, in the Properties window, select the Text property of the Button1. In the right-hand column, delete Button1 and replace it with Turn On Relay 1of R8x.
  • Do same to Button2, replace Button2 with Turn Off Relay 1 of R8x.
  • Resize buttons to display all text.

 

Step 4: Type code to the program
  • In the Form1.vb[ Designer], double click anywhere on the frame Form1 to open the file Form1.vb.
  • Type the following code to open the serial port at where the cursor is.

    SerialPort1.Open()

 

  • Return to the Form1.vb[ Designer], double click button Turn OnRelay 1 of R8x .
  • Type following code at where the cursor is.

    Dim data(2) As Byte

    data(0) = 254

    data(1) = 8

    SerialPort1.Write(data, 0, 2)

  • Return to the Form1.vb[ Designer], double click button Turn Off Relay 1 of R8x.
  • Type following code at where the cursor is.

    Dim data(2) As Byte

    data(0) = 254

    data(1) = 0

    SerialPort1.Write(data, 0, 2)

  • You may hideToolbox window and Properties window to get more room to show the code. You can do so by clicking the Auto Hide icon,which looks like a push pin .

 

Step 5: Run the project
  • On the Debug menu of the Visual Basic2008, click Start Debugging.( A shortcut to run the program is to press F5.)
  • The result of running the program is displayed as below.
  • Click button Turn On Relay 1 of R8x, the first relay will be turned on.
  • Click button Turn Off Relay 1 of R8x, the first relay will be turned off.

 

Above are all basic steps that is needed to control R8x from VB 2008.

Based on those steps, more buttons can be added to control anything from your desktop computer.

 

Download VB2008 R8x Test Program