Serial Port Tool focuses on COM Port communication software for RS232 related works.
How to Use Visual C# 2008 for R8X

Microsoft Visual C# 2008 is a programming language designed for building a wide range of applications that run on the .NET Framework. C# is simple, powerful, type-safe, and object-oriented. With its many innovations, C# enables rapid application development while retaining the expressiveness and elegance of C-style languages.The Visual C# 2008 Express Edtion is free download from Microsoft. If you are a programmer of C, C++ or C#, it is easy to switch to Visual C# 2008.

The following guide will teach ANYONE how to operate ANY of our products using Visual C# 2008 Express Edition. The example provided on this page is developed for Visual C# 2008 Express Edition. These directions are about 99% compatible with other VS2008 edition. Following these simple steps, you will be on your way to controlling 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 C# 2008 Express Edition.
  • The following screen appears.

 

  • On the File menu, click NewProject.

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

  • 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 C# 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.cs[ Designer], double click anywhere on the frame Form1 to open the file Form1.cs.
  • Type the following code to open the serial port at where the cursor is.

    serialPort1.Open();

  • Return to the Form1.cs[ Designer], double click button Turn OnRelay 1 of R8x .
  • Type following code at where the cursor is.
  • Byte[] data = new byte[2];

    data[0] = 254;

    data[1] = 8;

    serialPort1.Write(data, 0, 2);

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

    Byte[] data = new byte[2];

    data[0] = 254;

    data[1] = 0;

    serialPort1.Write(data, 0, 2);

  • You may hide Toolbox 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 C# 2008, 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 1of R8x, the first relay will be turned on.
  • Click button Turn Off Relay 1of R8x, the first relay will be turned off.

 

Above are all basic steps that is needed to control R8x from Visual C# 2008.

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

 

Download VC# 2008 R8x Test Program