System.NullReferenceException' occurred in GrapeCity.Spreadsheet.dll

Posted by: mobilewebengineer1 on 4 July 2023, 4:47 am EST

  • Posted 4 July 2023, 4:47 am EST - Updated 4 July 2023, 4:52 am EST

    I am trying my first run and believe I followed all your instructions. However, I am getting this error on the “MsgBox” line when I try to display a cell. Can you please point me in the right direction? I have also attached 1) and a screenshot of the error; 2) The simple Excel spreadsheet. I am stuck and unable to do anything else with Spread.NET.

    An unhandled exception of type ‘System.NullReferenceException’ occurred in GrapeCity.Spreadsheet.dll. Additional information: Object reference not set to an instance of an object.

    Imports FarPoint.Win.Spread
    Imports GrapeCity.Spreadsheet
    
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            Dim FpSpread1 As New FpSpread()
            Dim xlWorkbook As IWorkbook = WorkbookSet.CreateBase1Object(FpSpread1.AsWorkbook()) 'Set 1-base indexing per workbook
    
            Dim MyManifestWorksheet As IWorksheet
            FpSpread1.Visible = False   'Hide Spreadsheet
            FpSpread1.Open("TestExcelSpreadsheet.xlsx")
            MyManifestWorksheet = xlWorkbook.Worksheets("Sheet1")
    
            MsgBox(MyManifestWorksheet.Range(1, 1).Value.ToString)
            MsgBox(MyManifestWorksheet.Range("A1").Value.ToString)
            FpSpread1.Dispose()
        End Sub
    End Class

  • Posted 4 July 2023, 4:49 am EST

    1. Attached is “TestExcelSpreadsheet.xlsx” in a zip file

    TestExcelSpreadsheet.zip

  • Posted 4 July 2023, 4:01 pm EST

    Hello Vanavah,

    This has been replied to on your support case CAS-41706-T2W1Y6, please go to the MySupport portal to see the reply there.

    You can also directly access the below-given link for the same:

    https://www.grapecity.com/my-account/my-support/case/486f90e6-731a-ee11-8f6e-00224827e905

    Regards,

    Prabhat Sharma.

Need extra support?

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

Learn More

Forum Channels