Sheet datasource not updating when RowCount property changes

Posted by: info on 17 November 2020, 11:52 am EST

  • Posted 17 November 2020, 11:52 am EST

    Hi, I have a sheet datasource bounded to a datatable, when I add or delete a row from the sheet the datasource changes correctly, however when I change the sheet RowCount property the datasource is not updating:

    i.e.:
    fp.Sheets(iSheetIndex).RowCount = 2

    but:
    ctype(fp.Sheets(iSheetIndex).DataSource, datatable).rows.count = 1

    The sheet RowCount property changes but in the debugger the datasource datatable has the same number of rows (in this case one), what I'm doing wrong? Thanks.
  • Replied 17 November 2020, 12:01 pm EST

    The fpspread version is 4.0.3522.2008
  • Replied 17 November 2020, 9:11 pm EST

    Hi,

    Changing RowCount property adds unbound rows to the SheetView. Therefore, in order to add/delete bound rows to a sheet, you have to use the sheet Row collection's Add/Remove method.

    However, if you want to add unbound rows to the DataSource then you can use SheetView's AddRowToDataSource method. Please refer here:

    https://www.grapecity.com/spreadnet/docs/v14/online-win/spwin-databind-addrow.html

    Just in case if this method isn't available in the version you are using then I would request you to upgrade to the latest version i.e Spread 14.

    https://www.grapecity.com/spread/download-product

    Regards,
    Kartik
Need extra support?

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

Learn More

Forum Channels