I have been working extensively on building a C# application that incorporates some of the Codejock ActiveX controls. Everything works fine when I run the application on my development machine. When I deploy the application to another machine, I get the following exception:
System.ComponentModel.LicenseException: You do not have a license to use this ActiveX control. at System.Windows.Forms.AxHost.CreateInstance() at System.Windows.Forms.AxHost.GetOcxCreate() at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state) at System.Windows.Forms.AxHost.CreateHandle() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.AsHost.EndInit() at MyApp.MainForm.InitializeComponent() at MyApp.MainForm..ctor() at MyApp.MainForm.Main()
This exeception is throw when the following line of my InitializeComponents method is executed (btw, this is all the code automatically generated by VS.Net editor from Designer where 'axCommandBars' is the name of my instance of CommandBars)
((System.ComponentModel.ISupportInitialize)(this.axCommandBa rs)).EndInit();
My guess is that it's looking for a run-time license to the control that only existed on the development machine. With that in mind, I tried to use the 'CommandBars.GlobalSettings.License' property to set the text of my .LIC file. The problem is that I can't seem to get this property set without throwing an exception. Every time I try to set this property before the line that throws the LicenseException, I get an InvalidActiveXStateException.
Here's a snippet of the code I'm trying to use from the InitializeComponent() method:
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeOf(MainForm)); this.axCommandBars = new AxXtremeCommandBars.AxCommandBars(); ((System.ComponentModel.ISupportInitialize)(this.axCommandBa rs)).BeginInit(); this.SuspendLayout(); // Standard Property Assignments for CommandBars like 'Enabled', 'Locatation', etc this.axCommandBars.GlobalSettings.License = "blah..blah..blah"; this.axCommandBars.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("ax CommandBars.OcxState"))); ((System.ComponentModel.ISupportInitialize)(this.axCommandBa rs)).EndInit(); // This line throws 'InvalidLicense' exception
Any ideas? I looked at the C# samples you provided, and I didn't find any example of specifying the license. Thank you in advance!
|