Migrating from FPSpread3.0 COM to .NET

Posted by: mjuras on 8 September 2017, 1:33 pm EST

  • Posted 8 September 2017, 1:33 pm EST

    <FONT size=2>I am working on migrating a VB6 application to C#.  The application uses a UserControl that contains a Control Array of FPSpreads.  The control array has only one generic spread at design time and it grows and is configured dynamically at runtime based on external data requirements.  </FONT>

    I was planning to inherit from the .NET FPSpread class and extend the derived control with a few properties and methods to provide better backwards compatibility with Spread.OCX and minimize the impact on application logic.  <FONT size=2>However, I noted that in .NET designer code, I get two objects when I drop a spread control on my form: an FPSpread and a SheetView.   In rder to avoid maintaining dynamic collections of these two objects in the application layer, I moved the SheetView into the wrapper control (see below).  </FONT><FONT size=2>Unfortunately, VS2005 crashes hard when I drop the derived class on on a form.</FONT>

    <FONT size=2>Can anyone tell me why this is crashing.</FONT>

    <FONT face="courier new,courier">   public class SpreadSheet : FarPoint.Win.Spread.FpSpread
    private FarPoint.Win.Spread.SheetView _sheet1;
    private System.ComponentModel.IContainer components = null;

    public SpreadSheet()
    : base()
    this._sheet1 = new FarPoint.Win.Spread.SheetView();


    Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { this._sheet1 });

    this._sheet1.SheetName = "Sheet1";


    protected override void Dispose(bool disposing)
    if (disposing && (components != null))
    #region Component Designer generated code
    private void InitializeComponent()
    components = new System.ComponentModel.Container();

    <P><FONT size=2> 

  • Replied 8 September 2017, 1:33 pm EST

    Issue resolved.  I changed my approach to wrap the FPSpread in a UserControl rather than inheriting from FpSpread.  This allows the embedded FpSpread to take care of interfacing with the VS2005 designer -- which can be farily complex and sometimes quirky. 

    My user control had to implement an interface that exposes the events, properties and methods of the embedded FpSpread, but I was going to do something like this anyway because I did not want to rewrite thousands of lines of migrated application code that were designed for the COM interface. 

    Ideally I would like to use inheritance so I could have a dual interface -- COM and .NET, but I do not yet know enough about Component development to make that work with the VS designer.

  • Replied 8 September 2017, 1:33 pm EST

    This thread seems to provide the insights I will need to try to create a dual interface again.

     <FONT color=#555555>http://www.clubfarpoint.com/Forums/forums/thread/47106.aspx </FONT>


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels