Serial Port Tool focuses on COM Port communication software for RS232 related works.
How to Use NCDProXR Control in Visual Basic 2008

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 ProXR using NCDProXR Control in 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 VS2008 edition which include VB.

Follow these simple steps and you will be on your way to controlling ProXR from your desktop computer in 30 minutes or less. If you have questions, please contact us.

 

Step 1: Create a New Project
  • Open 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 new project.

 

Step 2: Add NCDProXR Control to the Project
  • Right click the mouse within Toobox window to show popup menu as below. (If the Toolbox window is not shown. You can open it by clicking menu View|Toolbox.)

  • Click Choose Items to open the following window.

  • Click Browse to show the open window as below.
  • Look in C:\Program Files\NCD\ProXR to find the file NCD.ProXR.dll. (If it does not appear in this location, you need to install the NCDProXR Control before you open Visual Basic 2008. )

  • Click Open to return to the Choose Toolbox Items window. The NCDProXR Control will be found in the list.

  • Click OK to add NCDProXR Control to the Toolbox.

  • Drag NCDProXR Control onto frame Form1 to add NcdProXR1.(If the properties window has been opened,the properties of NcdProXR1 will be shown on the right.)

 

Step 3: Add Buttons to the Project
  • Drag Button control from Toolbox onto frame Form1 to add Button1, Button2 and Button3.

  • Select Button1, in the Properties window, find the Text property of the Button1. In the right-hand column, delete Button1 and replace it with Turn On Relay 1.
  • Do same to Button2 and Button3, replace the text Button2 with Turn Off Relay 1, Button3 with Read Status of Relay 1, shown as below.

  • Drag Label control from Toolbox onto frame Form1 to add Label1.
  • Label1 will be used to display the status of Relay1 "ON" or "OFF".

 

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 and select bank 1 at where the cursor is.

    NcdProXR1.OpenPort()

NcdProXR1.SelectBank(1)

  • After typing NcdProXR1. , the method list of NcdProXR Control will appear as below. You can select OpenPort in the list or type it directly.

  • Return to the Form1.vb[ Designer], double click Button1.
  • Type following code at where the cursor is.
  • NcdProXR1.TurnOnRelay(1)

  • Return to the Form1.vb[ Designer], double click Button2.
  • Type following code at where the cursor is.

    NcdProXR1.TurnOffRelay(1)

  • You also can find TurnOnRelaly and TurnOffRelay in the method list of NcdProXR Control.

  • Return to the Form1.vb[ Designer], double click Button3.
  • Type following code at where the cursor is.

    Dim Status As Long

    Status = NcdProXR1.GetStatus(1)

    If Status = 0 Then

    Label1.Text = "OFF"

    Else

    Label1.Text = "ON"

    End If

  • You also can find GetStatus in the method list of NcdProXR Control.

 

Step 5: Run the project
  • On the Debug menu of the Visual Basic2008, click Start Debugging.
  • The result of running the program is displayed as below.
  • Now, you can turn on or turn off Relay1 using this applicationprogram. You also can read the status of Relay1.

 

Conclution
  • Above are all basic steps that is needed to using NCDPorXR Control from VB 2008.
  • It's very convinence to use NCRProXR Control to opertate ProXR.
  • Based on those steps, more buttons can be added to meet your requirement.

Download VB2008 NCDProXR Test Program

See Sample for Using NCDProXR Control in VB2008