|
Serial Port Tool focuses on COM Port communication software for RS232 related works.
|
||
|
How to Use NCDProXR Control in Visual Basic 6
Visual Basic is our preferred language for communicating to the NCD product line. We have written all of our manuals to extensively support Visual Basic. Visual Basic stocks a powerhouse of features that make it one of the most appealing and easy languages to use. Advanced users will find VB is ideally suited for intensely complex Multi-Media, Database, Mathematical, Video, and Imaging applications. If you would like to get an idea of just how powerful Visual Basic can be, please visit http://www.vbxtras.com/ and have a look at the hundreds of corporations who are developing extensions that add powerful capabilities to this amazing language. The following guide will teach ANYONE how to operate ANY of our products using Visual Basic. The examples provided on this page were developed for Visual Basic 6 Professional. These directions are about 99% compatible with older versions of Visual Basic as well. You will need NCDProXR Control ActiveX for these directions to work. 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 |
||
|
|
||
|
Start Visual Basic and Select Open. |
||
|
Step 2: Add NCDProXR Control to the Project |
||
![]() |
||
|
Right Click on the Tool Bar and Select "Components..." to open the
dialog below.
|
||
|
|
||
|
Select "NCDProXR" and click "OK" to add the control to the toolbox. ( If it does not appear in the list, you need to install the NCDProXR control. ) |
||
|
||
|
Step 3: Add NCDProXR Control to your Project |
||
|
||
|
Step 4: Set the Properties of NCDProXR Control |
||
|
||
![]() |
||
| Double click anywhere of Form1 to show the code windown. Add the above code for opening port when the form is loaded. | ||
|
Step 5: Control NCD Device with NCDProXR Control |
||
![]() |
||
|
In the Toolbox, double click the "CommandButton" to add a "Button"
to Form1.
|
||
![]() |
||
|
Double Click the "Command1" button
to show the code window. Type the code here. You may substitute the code for
other method supplied in NCDProXR Control Manuals.
The text on the button can be changed by he caption property in the "Properties" window. Here the "Command1" is changed to "Control Device " shown as above. |
||
|
Step 6: Retrieve Status from the Device |
||
|
In some cases, you may want to read status
from an NCD device and process the result. For example, you may want to know
the On/Off status of a relay, or if you want to read an A/D value from one of our
devices that supports A/D conversion. The example shown below demonstrates
reading relay status display the result in a Visual Basic program.
|
||
![]() |
||
|
Create a new button "Query Status".
Create a Label under the new button.The button will be used to read the status of
one relay on ProXR board. The status will appear as a number 0, 1 or -1(0
for OFF, 1 for ON, -1 for failed).
|
||
|
|
||
|
Double double click your new button "Query Status". The "Command2 Click" window will appear. Type the code shown above. When this button is clicked, the program will read the status from device. The return value will be displayed on the Label. The project can be run now. Simply click the Start button to run your project (small arrow pointing to the right on the upper tool bar). |
||
| Conclusion | ||
| These are the basic steps to control NCD device with NCDProXR control in Visual Basic. More functions of NCDProXR control can be used on your way to control anyting. | ||
| Download VB6 NCDProXR Test Program | ||
|
|