Display Page:
Display Page:
| 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 NCD Control ActiveX for these directions to work. You can get it in this site. It is used to control our devices from your computer. Follow these simple steps and you will be on your way to controlling ANYTHING from your desktop computer in 30 minutes or less. If you have questions, please contact Ryan Sheldon, ryan@controlanything.com. |
||
| Step 1: Create a New Project | ||
|
|
||
|
Start Visual Basic and Select Open. |
||
| Step 2: Add NCD Control to your Program | ||
![]() |
||
| Right Click on the Tool Bar and Select "Components..." | ||
|
|
||
| The Above Dialog Box will Open. Scroll Down and put a check next to "NCD Control";. If it does not appear in the list, then you will need to install the NCD control. It can be get from http://www.controlanything.com. Next, Select "OK". This adds NCD Control to your toolbox. | ||
|
||
| Step 3: Add NCD Control to your Project | ||
|
||
| Step 4: Set the Properties of NCD Control | ||
![]() |
||
| Step 5: Control NCD Device with NCD Control | ||
![]() |
||
| In your Toolbox, double click the "Command Button" (as shown near the mouse pointer above). This will add a "Button" to your program. Double Click on the "Command1" Button you just created. | ||
![]() |
||
| Double Clicking on the "Command1" button will open the "Command1 Click" window, which holds the lines of code that will be executed every time the user pushes the button. Type the lines of code shown above. These lines of code will activate the first relay on the R8x Pro series relay controller. You may substitute this lines of code for other method supplied in NCD Control Manuals.
Also note the position of the pointer in the photo above. You can change the text on the button by changing the caption property in the "Properties" window. Change the caption to read "Control Device " as shown above. You are now ready to run your program. Simply click the Start button to run your program (small arrow pointing to the right on the upper tool bar). That is all that is needed to control our products from Visual Basic. In no time, you will be able to create several buttons capable of controlling anything from your desktop computer. |
||
| Step 6: Retrieve Status from the Device to your Computer | ||
| 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 from R8x Pro and display the result in a Visual Basic program. | ||
![]() |
||
| Create a new button and label it "Query Status". Create a Label by double clicking the "A" in the toolbox (shown near the pointer). The button will be used to read the status of all 8 relays on an R8x Pro Relay Controller. The status will appear as a number from 0-255 "Caption" to the "Label" for a successful reading, and appear as -1 for failed reading. | ||
|
|
||
|
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 correct status is from 0 - 255. A return value of -1 represents a failure of reading status. The Label1.Caption=Status is used to display the returned value to the user. |
||
| Conclusion | ||
| These are the basic requirements for controlling and query status using Visual Basic and a typical NCD device. NCD Control manuals will have details regarding methods the device is capable of accepting, as well as function that query status of device . You may download this example by clicking on the link below. This example was written in VB6, and will not load in earlier versions of VB. However, these instructions are nearly identical, so building an application with these directions will only take a few minutes. | ||
| Download VB6 NCD Control Test Program |
计算机控制继电器
独立继电器
其他产品
产品支持
| 可靠的服务 |
|
浏览我们其他的网站: www.SignalSwitch.com www.relaycontrollers.com |
English: 中文: ![]() |
|
National Control Devices, LLC全球最大的计算机控制开关设备制造商,始于1995年! |
|
Please Note: Our office and production facility will be closed for Memorial Day on May 27th.
Orders will be processed in the order they are received.