With this example, you can write to and read from a serial instrument with the Measurement Studio ActiveX Serial control with Microsoft Visual C# .NET. By default, the example configures an instrument connected to COM1 to communicate at a 9600 baud rate. Before you run this example, you must configure the device. To configure the device, specify COM Port and Baud Rate, then click Configure. You also can reset the device by clicking Reset.
When using any ActiveX controls in Microsoft Visual Studio .NET, keep the following differences in mind:
1.) Visual Studio .NET generates a Runtime Callable Wrapper (RCW) around each control, and you must go through the Interop layer to use the controls. As a result, some class names differ from the names in Visual Basic 6.0.
2.) Hosting an ActiveX control in Visual Studio .NET requires unmanaged code permissions.
3.) Hosting an ActiveX control in a Windows Form increases the size of your project files because the entire control is embedded in the form.
For more information about using ActiveX controls in Visual Studio .NET, refer to the Visual Studio .NET help.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.