Jump to content
Software FX Community

COM ChartFX used in .NET component for VB App


Recommended Posts


We have a license to ChartFX 6.2 for .NET 1.1 and we use it in a component library for our .NET applications.  Now we would like to try out the COM version using our exist .NET code via interoperability for a VB app.  I downloaded the trial version for testing, though received the message "ChartFX License has Expired" instead of the actual chart.  I have a feeling that maybe the message only appears for the trial versions, but I would like to know for sure before purchasing and using the COM version.  Below is my test code that I used.  After recompiling both projects, I deployed the .NET library and VB app along with ChartFX COM components, regasm and regsvr32 the components, and received the error when trying to load the chart via the VB app.  Please let me know if this type of scenerio would work for the Full ChartFX 6.2 version.  Thanks!


[C# class library]// InteropTest.csusing System;using System.Runtime.InteropServices;

namespace TestInterop { [Guid("817557D5-4A47-4ff4-9113-7AD37E67C457")] public interface IInteropTest { void ShowChart(); }

 [Guid("83FF1DFF-E926-483a-B1D5-C7FC70824FB5")] public class InteropTest : IInteropTest { public void ShowChart() {  test form = new test();  form.ShowDialog(); } }}

//test.csusing System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Runtime.InteropServices;

namespace TestInterop { /// <summary> /// Summary description for test. /// </summary> [ComVisible(false)] internal class test : System.Windows.Forms.Form { private AxCfx62ClientServer.AxChart axChart1; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;

public test() {  //  // Required for Windows Form Designer support  //  InitializeComponent();

 //  // TODO: Add any constructor code after InitializeComponent call  // }

/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) {  if( disposing )  { if(components != null) {  components.Dispose(); }  }  base.Dispose( disposing ); }

#region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() {  System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(test));  this.axChart1 = new AxCfx62ClientServer.AxChart();  ((System.ComponentModel.ISupportInitialize)(this.axChart1)).BeginInit();  this.SuspendLayout();  //  // axChart1  //  this.axChart1.DataSourceAdo = null;  this.axChart1.Enabled = true;  this.axChart1.Location = new System.Drawing.Point(0, 0);  this.axChart1.Name = "axChart1";  this.axChart1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axChart1.OcxState")));  this.axChart1.Size = new System.Drawing.Size(536, 456);  this.axChart1.TabIndex = 0;  //  // test  //  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);  this.ClientSize = new System.Drawing.Size(536, 454);  this.Controls.Add(this.axChart1);  this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;  this.MaximizeBox = false;  this.MinimizeBox = false;  this.Name = "test";  this.Text = "test";  ((System.ComponentModel.ISupportInitialize)(this.axChart1)).EndInit();  this.ResumeLayout(false);

} #endregion }}

[VB application - a form with one button named Command1]Option Explicit

Private Sub Command1_Click() Dim objITest As TestInterop.IInteropTest

 Set objITest = New TestInterop.InteropTest objITest.ShowChart

 Set objITest = NothingEnd Sub

Link to comment
Share on other sites

  • 2 weeks later...

We have not tested our COM version in a .NET App. Note that you will get the exact same features so unless you are building a true COM app (VB6, MFC, etc.) there is no advantage on using the COM version over the .NET version you already own.


Link to comment
Share on other sites

Hey JuanC,

 Thanks for the reply.  We're using ChartFX in a .NET component that will plug-in to our existing COM (VB) application via late-binding to produce some basic charting functionality in a separate dialog.  Though this .NET component isn't stand-alone, it is created and used by the VB app.  So when we deploy this .NET component to our customers to use with our existing COM (VB) application, we obtain some licensing issues.

 The .NET ChartFX component implements its own LicenseProvider which, I'm assuming, grabs the license information from the assembly's manifest.  Unfortunately COM applications do not have a manifest, and the work around stated on SoftwareFX's knowledge base to include the .license info into the app's resource file does not work in VB6.

In order to get around this problem, we're hoping the COM ChartFX component implements the IClassFactory2 interface for it's licensing, which our COM (VB) application can handle.

Which brings me back to my original question.  Before purchasing the COM ChartFX component, we would like to confirm that the above code does infact work with the full version.  During my tests, I used the trial and got a "license has expired" error when deploying the test code mentioned above.  If you have some spare time JuanC to confirm this, it would be much appreciated.  Thanks.


Link to comment
Share on other sites

You will have a similar problem with the COM version. Chart FX COM does support IClassFactory2 as the mechanism for licensing, however, because you are going to be using Chart FX indirectly from your VB app (you have a wrapper .NET control), VB will not see it and therefore will not include the necessary license information in the EXE. Since it is your component and not the VB app who is creating the chart (this is what I understood from your post) IClassFactory2 will never be called.

What you need is a special license, you need to provide Chart FX for .NET (6 or 7) with a license from your "wrapper" component and for this you need to contact Software FX Sales. The technical reason for this is simple: if it was allowed to pass the license from one component to another, it would be extremely easy to bypass the component license by building a wrapper control that offer no functionality whatsoever.

 You need this whether you are using COM or .NET, no difference.


Link to comment
Share on other sites

Yeah, I figured the .NET application wouldn't store the COM license for use when creating the chart via run-time.  And from what it sounds, ChartFX requires a run-time license.

What I was going to do, was obtain the license code for the object using licreqst and manually set the licensekey field in the .NET component for the ActiveX ChartFX.  And just use this license key to create the object (similar to what VB would do).  For example:

System.Reflection.FieldInfo f =
       System.Reflection.BindingFlags.NonPublic |
f.SetValue(axChart1, "licensekey");

or is this what I'm suppose to be doing with the "special license" key.  We have contacted Sales for a special license key, yet they requested some information (and possibly some sample code? I wasn't the one who contacted them) on how we would be using ChartFX.  We haven't heard back from Sales yet so we are exploring some other alternatives.  Cheers!


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...