Inconsistent CheckBoxCellType Behavior

Posted by: twherzog on 8 September 2017, 3:14 pm EST

  • Posted 8 September 2017, 3:14 pm EST

    I have a project that contains several forms in a library which are used in multiple places within my applications. Many of these forms contain spreadsheets. However, even though I'm able to use the CheckBoxCellType successfully within most of them, I'm having a problem with a NullReferenceException on one of them when the SpreadView is being drawn. I cannot for the life of me figure out what is different about this form that is causing this error. I have tried changing the properties on both the SpreadSheet object and the Sheet object to match those of the forms that run without a hitch, but I still cannot seem to get past this error.

    Here is a snippet of my code where I'm initializing the SpreadSheet with the CheckBoxCellType in the forms:

    Dim ckbxcell As New FarPoint.Win.Spread.CellType.CheckBoxCellType()

    With ssFormations_Sheet1
    'Filter Zone
    .Columns(Cols.Selected).CellType = ckbxcell
    .Columns(Cols.Selected).Label = "(6)" & Environment.NewLine & "Filter" & Environment.NewLine & "Zone"
    .Columns(Cols.Selected).Width = 70
    .Columns(Cols.Selected).HorizontalAlignment = CellHorizontalAlignment.Center

    'Visible Top
    .Columns(Cols.VisibleTop).CellType = ckbxcell
    .Columns(Cols.VisibleTop).Label = "(7)" & Environment.NewLine & "Visible" & Environment.NewLine & "Top"
    .Columns(Cols.VisibleTop).Width = 40
    .Columns(Cols.VisibleTop).HorizontalAlignment = CellHorizontalAlignment.Center
    End With


    This is being done the same way in the form without the problem as well as the form with the problem.

    Here is the details of the error I'm receiving:
    System.NullReferenceException occurred
    HResult=-2147467261
    Message=Object reference not set to an instance of an object.
    Source=FarPoint.Win.Spread
    StackTrace:
    at FarPoint.Win.Spread.SpreadView.g(Graphics A_0, Int32 A_1, Int32 A_2)
    InnerException:
  • Replied 8 September 2017, 3:14 pm EST

    Hello,

    I am unable to run your code due to some unknown variables and other reasons. Also , I tried a number of ways for replicating the same issue at my end but could not get success. However, there might be the following reasons for this problem:

    1. If the SheetView Object reference not set to an instance of an object.
    [OR]
    2. SheetView Object set to 'NULL' before actually using it in the same line where the exception occurs.

    Kindly debug your code and check if these are not the cases. If this does not solve your problem, please send us a sample application with exact steps to reproduce the issue so that we can assist you further accordingly.

    Thanks & Regards,
    Pragati Kaushik
  • Replied 8 September 2017, 3:14 pm EST

    Strangely enough I'm not able to reproduce the error on my laptop, only my work PC, so I'm thinking it has something to do with the project settings (I'm using a different Unit Test Project at home) or the installed DLL's. I'll look into each of those a little further tomorrow and see if I can't get it to work.
  • Marked as Answer

    Replied 8 September 2017, 3:14 pm EST

    Hi,

    Please take your time to test the behavior at your end and let us know if you need any further assistance on the same.

    Thanks,
    Pragati Kaushik
Need extra support?

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

Learn More

Forum Channels