Error opening form in design mode

Posted by: msmith-fp on 8 September 2017, 12:33 pm EST

  • Posted 8 September 2017, 12:33 pm EST

    I have a project that was built in Visual Studio 2003 and I am converting it to Visual Studio 2005.  When I try to open any form in design mode which contains a FP Spread control I get errors that say ...









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



    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.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

    ...  I have tried reinstalling the controls but that did not help, the version of FP Win Spread I am using is 1.0.6.0   Any ideas?

  • Replied 8 September 2017, 12:33 pm EST

    I spoke too soon, the original error is corrected but I am getting a similar message when I try to open a different form containing the control in design mode I get the following error  
    Value cannot be null. Parameter name: value
    at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
    When I run in debug mode I get the following error
    {"Value cannot be null.
    Parameter name: value"}


       at FarPoint.Win.Spread.SheetView.set_Models(DocumentModels value)
       at Test.QuoteMgr.InitializeComponent() in C:\Documents and Settings\MMSMITH\My Documents\Visual Studio 2005\Projects\PowerQuote\QuoteMgr.vb:line 663
       at Test.QuoteMgr..ctor() in C:\Documents and Settings\MMSMITH\My Documents\Visual Studio 2005\Projects\PowerQuote\QuoteMgr.vb:line 65
       at Test.Form1.sMsg_ButtonClicked(Object sender, EditorNotifyEventArgs e) in C:\Documents and Settings\MMSMITH\My Documents\Visual Studio 2005\Projects\PowerQuote\Main.vb:line 1794
       at FarPoint.Win.Spread.FpSpread.OnButtonClicked(EditorNotifyEventArgs e)
       at FarPoint.Win.Spread.FpSpread.d(SpreadView A_0, Control A_1, Int32 A_2, Int32 A_3)
       at FarPoint.Win.Spread.SpreadView.d(Object A_0, EventArgs A_1)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at FarPoint.Win.FpButton.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Test.Form1.Main() in C:\Documents and Settings\MMSMITH\My Documents\Visual Studio 2005\Projects\PowerQuote\Main.vb:line 11
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

  • Replied 8 September 2017, 12:33 pm EST

    Thank You so much.  I upgraded to v 1.1.0.0 and it is working
  • Replied 8 September 2017, 12:33 pm EST

    You will have to upgrade to the latest version of 1.x.x.x.  1.0.6.0 will not work in VS2005.
  • Replied 8 September 2017, 12:33 pm EST

    If you go into the InitializeComponent section can you comment out that line of code? 
  • Replied 8 September 2017, 12:33 pm EST

    Yes.  I commented out the following line:

    Me.sFilters_Sheet1.Models = CType(resources.GetObject("sFilters_Sheet1.Models"), FarPoint.Win.Spread.SheetView.DocumentModels)


    and now the form does not generate an error when running the application but my FPSpread is no longer formatted correctly.  I still get the same error when I try to view the form in Design View.


    Thanks

  • Replied 8 September 2017, 12:33 pm EST

    You can try to create a new project and then compare the settings in InitializeComponent with what's in your old project.  Are you able to move the spread around with the arrow keys at design time?  If you can, that should regenerate the InitializeComponent code.
  • Replied 8 September 2017, 12:33 pm EST

    Hello,


    This is a known bug in the product in Visual Studio 2005. You would need to open the InitializeComponent section of code and add appropriate code Columns, Rows, Cells, etc before the Get function. The Get is getting a particular Column, Row or Cell from the ColumnHeader, SheetView, and RowHeader class.

  • Replied 8 September 2017, 12:33 pm EST

    Thank you very much.  Everything seems to be working fine now.
  • Replied 8 September 2017, 12:33 pm EST

    Actually now I am having problems where every time I make a change to my form, the changes that I made by adding Cells, Columns, Rows in front of the Gets disappear.  There is a warning stating "found conflicts between different versions of the same dependent assembly".  Is this what might be causing the issue?  How should I remedy this situation?
  • Replied 8 September 2017, 12:33 pm EST

    Hello,


    This error message suggests that you have the SerializeModels property of the SheetView set to True and in this serialized data is some version number being stored. The error is either coming due to not having the resx file attached with the project or not having the version of Spread that is being referenced correctly loading the information from the models.


    If the first issue is your problem, you just need to move the resx file into the project and reload. If the second issue is the problem, you either need to reload the older version of the project that did load and set the SerializeModels property to False and resave the project for loading into the new version. Or, set up a binding redirect for your project or framework to load the correct version of the assembly. You can find steps to implement this in our readme under the upgrading project section.

  • Replied 8 September 2017, 12:33 pm EST

    I was able to get rid of the "found conflicts".  I removed references to the older versions of CalcEngine, Excel, and PluginCalander.WinForms and added the newer versions.  I think that was the reason for the warning.  However, I am still having the issue that whenever I make a change to my form, all of my changes in InitializeComponent disappear.
  • Replied 8 September 2017, 12:33 pm EST

    I am trying to convert projects from 2003 to 2005 also and am running into the same issue.  Our version is 1.0.4.0.

  • Replied 8 September 2017, 12:33 pm EST

    I upgraded to v1.1.  Now if I try do make any changes to the design of my form, I get these errors:


    'Get' is not a member of 'FarPoint.Win.Spread.ColumnHeader'.


    'Get' is not a member of 'FarPoint.Win.Spread.SheetView'.


    'Default' is not a member of 'FarPoint.Win.Spread.RowHeader'.

  • Replied 8 September 2017, 12:33 pm EST

    Hello,


    This is due to a bug in the Spread for Windows Forms (version 1.1.0.0) in Visual Studio 2005 code serialization. Making changes to the form will cause the Spread to regenerate the code in the InitializeComponent section and take you back to the code minus the classes (Column, Row, and Cell) being called. I would suggest either not making any more changes, reverting back to the 1.0.9.0 build of Spread for Windows Forms, or best, upgrade to the version 2.5 or 3 of Spread for Windows Forms to get the fix and all the new features in the Spread product.

  • Replied 8 September 2017, 12:33 pm EST

    Hello,


    It should not take a long time to upgrade. You would need to fix the code with the Gets in the InitializeComponent section, but the only other thnig you need to do is to remove the reference to the 1.0 version and replace it with the 2.5 or 3 version.

  • Replied 8 September 2017, 12:33 pm EST

    Oops I didn't see this latest post before my last post.  If I have a lot of spread controls in my application will it take a long time to upgrade all of them to 2.5 or 3?
  • Replied 8 September 2017, 12:33 pm EST

    What changes are you referring to?  Looking at the code in the resx file, it is not referencing any version of Farpoint Spread.


    Here is what happens.  I change all of the method calls like I was told.  Then I make changes to the form design and when I try to debug, it returns all of the methods to what they were before.  Even in code that is not in Initialize Component.  I have routines that call the method sprdSaleItems_Sheet1.Columns.GetSelections.  I change this to  sprdSaleItems_Sheet1.GetSelections and when I try to debug, this reverts back as well.


    Thank you

  • Replied 8 September 2017, 12:33 pm EST

    It sounds like the resx file is still referencing another version and when you make a change the old values are written back to the InitializeComponent.  Did you try to implement any of the changes Scott mentioned earlier in the post?
Need extra support?

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

Learn More

Forum Channels