Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ASP.NET (VB.NET) - cwui.ocx "errors loading control" error

I'm trying to use the cwKnob control (cwui.ocx) in a webform (ASP.NET / VB.NET). I place it on a webform and import a style and it looks great. I save it, then close the solution and reopen it and when I goto the page I get this error: "Errors loading control. The default settings for the control will be used."

I've tried replacing the control several times. Any ideas? Has anyone got this control working on a webform? If so, I'd be EXTREMELY interested.
0 Kudos
Message 1 of 15
(6,962 Views)
Interestingly enough when I create a new Windows Application (VB.NET) the knob control works fine.

I've uninstalled/reinstalled Meas. Studio 6 a few times and still have this crazy problem.

Please help!
0 Kudos
Message 2 of 15
(6,962 Views)
First, a disclaimer: the Measurement Studio ActiveX controls are not officially supported in ASP.NET, so there are no guarantees regarding how well the controls will work in ASP.NET applications.

Having said that ... the differences that you're seeing with the knob between ASP.NET and Windows Forms have more to do with the nature of each of those respective environments and less to do with the behavior of the knob. In Windows Forms, a .NET wrapper class is generated for the ActiveX object and settings are persisted as generated code using that auto-generated interface. In ASP.NET, the settings of the knob are persisted as nested param tags of the HTML object tag. The error that you're seeing is from loading the persisted settings.

One way to work aroun
d this would be to create a user control in VB6 that hosted the knob control with your custom settings. Your settings would be persisted as they would be in any other VB application, which works very well. Then you could use your user control in a web page and since you handled all of your settings when creating the user control, the only values that you would need to customize in your object tag are the width and the height.

- Elton
0 Kudos
Message 3 of 15
(6,962 Views)
Thanks. I will try this. Do you know if NI is planning to come out with real, .NET managed, server side ASP.NET controls? If so when?
0 Kudos
Message 4 of 15
(6,962 Views)
This is certainly an area that we are looking into. As with any new product or technology, we are always looking for feedback. If you're interested in Measurement Studio ASP controls, please feel free to contact me directly at shelley.erickson@ni.com with product suggestions and application examples.
- Shelley
0 Kudos
Message 5 of 15
(6,962 Views)
Elton, so what you are saying is to create a user control in VB.NET with the NI knob inside of it, then use this user control (now "managed") in ASP.NET?
0 Kudos
Message 6 of 15
(6,964 Views)
You could try that, but what I was actually suggesting was to create a user control in VB6 that hosted the Measurement Studio knob control, then use this user control in your web page like any other ActiveX control. I think this is the easiest way to do this.

If you created an ASP.NET user control in VB.NET, you would still have the same persistence issues that you had when trying to use the control in an ASP.NET page. If you created a Windows Forms user control, you would introduce a dependency to the .NET Framework on the client, which is probably undesired.

- Elton
0 Kudos
Message 7 of 15
(6,964 Views)
First off, thanks for all your help so far. You are an invaluable resource!

Based on your suggestion I created a new VB6 "ActiveX Control" project. I put the CWKnob control on it along with a label. Here is my simple code:

Public Sub SetValue(Value As Integer)
CwKnob.Value = Value
lblValue.Caption = CwKnob.Value
End Sub
Public Function GetValue() As Integer
GetValue = CwKnob.Value
End Function

I created MyKnob.ocx and tested it in another VB6 standard application - worked fine! I could set the value, read it, etc... 🙂

I went to a new ASP.NET webform and added the reference to the ocx. I "drew" the gauge on the webform - no problem. Questions:

1. How can I set the value of the Activ
eX control (either by using my SetValue function, or by another means)? (I set the ID/Name of the new control, but I can't simply say MyCtrl.SetValue. I assume I'll have to use a PARAM manipulation, but I don't any useful PARAM settings.)

2. When I run the form I always get this msg now: "This page provides potentially unsafe information to an ActiveX control. Your current security settings prohibit running controls in this manner. As a result, this page may not display correctly." It seems like it's an IE problem, but I hope my users won't have to make changes to their IE settings just to view this webpage. Any ideas?

I've attached the OCX file for your reference.

Thanks for your help!
0 Kudos
Message 8 of 15
(6,964 Views)
1.) Instead of defining GetValue and SetValue methods on the control, define a Value property, like this:

Public Property Get Value() As Integer
GetValue = CwKnob.Value
End Property

Public Property Let Value(val As Integer)
CwKnob.Value = Value
lblValue.Caption = CwKnob.Value
End Property

Once you have a property, you should be able to set it via param tags. Alternatively, you could call the method in the page's load event.

2.) One thing you could do is code sign your control. See Introduction to Code Signing for more information. Once your control is code signed, users would get a p
rompt the first time they access the page. If they specify that they trust the publisher (you), the control would be installed and the control should work the next time they access the page.

- Elton
0 Kudos
Message 9 of 15
(6,964 Views)
Per your suggestion I made them properties. In my HTML I still don't see those values as available PARAM's. Here's the HTML in my aspx webform...






Do you know how I can expose, view and change the PARAM values?

Thanks again.
0 Kudos
Message 10 of 15
(6,838 Views)