Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with the Measurement Studio Package

Hi I am new to using the Measurement Studio Package.  I am currently developing an application with VS .NET 2003 and using the UI controls that Measurement Studio offers for this version. I have two questions that I hope someone will be able to help me with.  Can the UI controls be used within a WinForm application being developed in VS 2003?  Or is the packages better suited for use with MFC projects?  It seems the project is ok most of the time but every now and then when I add or update a control and the design view beings its update, some of the controls disappear visually from the WinForm even thought they are still declared in the header file.  Is this a common issue?  Could there be a bug in 2003?  I end up having to recreate the missing control and the fixing up the actual declaration.  My other question deals with possibly upgrading to VS .NET 2005.  I have tried to open up the project I developed in 2003 but after the conversion I cannot open the WinForms created.  The error I receive when trying to open one of the Forms is that the controls cannot be found.  I thought I read on a different post on this site that the implementation was different between the two versions of VS .NET.  I was wondering what steps need to be made to correc the error on the control dlls.  Here is a look at one of the errors.

Could not find type 'AxInterop.CWUIControlsLib.AxCWKnob'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.

The variable 'axCWKnob_CHANNEL_SWITCH' is either undeclared or was never assigned.

Hide    


at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)


0 Kudos
Message 1 of 4
(4,388 Views)
Hi mtd32610,

I'll try and answer all your questions in this one post, but if I don't, please let me know.

It is first important to understand what types of UI controls Measurement Studio offers. Currently Measurement Studio offers two different types of controls which are ActiveX controls (i.e. CWGraph, CWKnob, etc) and .NET controls.  If you are programming in MFC, then you should be using the ActiveX controls but if you are programming in a .NET language such as C# or VB.NET, you should be using the .NET controls.  We have .NET controls for both Visual Studio .NET 2003 and Visual Studio 2005. 

Now, based upon the error message you are showing, it appears you are using ActiveX controls in .NET.  This is possible and this concept is described in the Using Measurement Studio ActiveX Controls in Visual Studio .NET tutorial. Allow me to quickly explain a few important concepts when using ActiveX controls in .NET. 

Because Windows Forms can host only Windows Forms controls, Visual Studio automatically creates Windows Forms wrappers for ActiveX controls so you can continue to use them in Visual Studio .NET projects.  For example, when you place a CWKnob ActiveX control on a Windows Form, Visual Studio uses the COM type library to automatically create two DLLs for the entire OCX file (file that can contain one or more several ActiveX controls). One DLL contains a Common Language Runtime (CLR) proxy for the OCX, and the second contains a Windows Form proxy for the OCX.

The CLR proxy DLL is known as the Runtime Callable Wrapper (RCW) and contains a .NET version of the COM type library. It defines all objects and interfaces found in the original COM type library and the classes that implement the interfaces. Visual Studio .NET names this DLL Interop.ID.dll, where ID is the name of the type library. In your case, the name is Interop.CWUIControlsLib.dll.  The Interop prefix denotes that the RCW incorporates services from the Interop layer, which controls marshalling and interoperability between COM and the .NET Framework.

The Windows Form proxy DLL provides a .NET control that calls the RCW.  This DLL defines the properties, methods, and events you can set, call, and handle programmatically. Visual Studio names this DLL AxInterop.ID.dll, where ID is the name of the type library.  In your case, the name is AxInterop.CWUIControlsLib.dll. The Ax prefix denotes that the wrapper classes inherit from the AxHost class to expose the ActiveX control as a Windows Forms control.

Now, I have upgraded Visual Studio .NET 2003 projects up to VS 2005 before which contain ActiveX controls and never had any problems. I did a quick test just a few minutes ago in C# where I created a VS 2003 application with the CWKnob control and upgraded that application to VS 2005 and didn't see any weird behavior. The project still ran. 

Continued on next post....
Jonathan N.
National Instruments
0 Kudos
Message 2 of 4
(4,385 Views)
Now, for the error you mention, I would be curious if you looked in your Solution Explorer under the Reference folder, if you saw the assemblies, AxCWUIControlsLib and CWUIControlsLib. If they are not there or you see some error associated with them, remove them and then try and re-add them. To re-add them, just right-click on the References item and select Add Reference. Then navigate those assemblies.  See if that helps. 

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 3 of 4
(4,383 Views)
Jonathan,
    Thank you for some of the information give.  I still need to take a look at that error when going from VS 2003 to 2005.  But I know realize that I can add the need .Net controls rather than the earlier Active X ones.  I will see if this change in controls makes a difference when I add or update a control and some of the controls disappear on me.

Matthew
0 Kudos
Message 4 of 4
(4,375 Views)