Binding a data entry form to a database

Posted by: dairymilk7777 on 8 September 2017, 1:07 pm EST

  • Posted 8 September 2017, 1:07 pm EST


    I'am developing a data entry form using spread for windows form 4.0.

    So in one range of cells all 'Daily Sales' information is entered by the user. In another range of cell on the same sheet 'Cash Expenses' is entered by the user and so on. Each range represents data from a seperate table.

    Is it possible to bind such cell ranges to a database or will I have to retrieve data from the database on hidden sheets and then copy them into the relevant cell range(s) in the data entry form sheet and vice-versa.

    Thanks in advance

    Best Regards

  • Replied 8 September 2017, 1:07 pm EST

    Spread Win 4 supports cell range binding.  For example:

    Dim data As New

    data.DataSource = dt

    ' Bind a cell range

    data.Spread = FpSpread1

    data.SheetName = "Sheet1"

    data.MapperInfo = New FarPoint.Win.Spread.Data.MapperInfo(3, 2,
    1, 1)


  • Replied 8 September 2017, 1:07 pm EST


    Thanks very much.

    However I could not find MapperInfo anywhere in the help files / documentation.

    Also I presume the interface of MapperInfo (3,2,1,1) is MapperInfo
    (TopLeftRow, TopLeftColumn, BottomRightRow, BottomRightColumn)

    What is the type of 'dt' as in data.datasource = dt.

    I forgot to mention I am using c# and VS 2005 with .net framework 2.x

  • Replied 8 September 2017, 1:07 pm EST

    The MapperInfo and the associated binding properties and methods for Range Support we're inadvertently left out of documentation.  In Gina's example for MapperInfo the parameters are row, column, rowcount and columncount.  So basically it's as you stated.  The 'dt' she mentioned is a variable defined as a DataTable. 
  • Replied 8 September 2017, 1:07 pm EST


    Thanks for that. I can now display data from a database in different places on the same sheet.

    As changes are made to data in these bound cells will they automatically be reflected to the datatable specifiecd as the datasource of the SpreadDataBindingAdapter.

    In other words will a datatable.AcceptChanges () send all updated data back to the database.

    Thanks is advance


  • Replied 8 September 2017, 1:07 pm EST

    The data source will be automatically updated with changes to the cells as they happen, but the data row will not be committed until the active row changes in the sheet, or something else happens to change the active record.  You can explicitly call EndEdit on the DataRow in code to force the changes to be committed to the DataTable.

    Getting the changes saved back to the database will require calling the Update method on the data adapter.  Generally, you call AcceptChanges after calling Update.
Need extra support?

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

Learn More

Forum Channels