Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example loads data in a database into the Spread control. Users can click a button to change data in the Spread control, but not update the database, then click another button to refresh the data in the control using the data from the database. The C++ example assumes you are working in Visual C++ and set up the data binding at design time.

C++

//Reload the original data from the recordset
    m_ADOSpread.DataRefresh();

Visual Basic

Private Sub Form_Load()
    ' Create a recordset using Biblio and bind to Spread
    Set rec = New ADODB.Recordset
    Set Conn = New ADODB.Connection

    Query = "select * from Titles;"

    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\Program Files\Microsoft Visual Studio\VB\biblio.mdb;Persist Security Info=False"
    rec.Open Query, Conn, adOpenKeyset, adLockOptimistic
    Set fpSpread1.DataSource = rec
End Sub

Private Sub Command1_Click()
    ' Make a change to Spread without updating the database
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.Text = "test"
End Sub

Private Sub Command2_Click()
    ' Reload the original data from the recordset
    fpSpread1.DataRefresh
End Sub

Copyright © GrapeCity, inc. All rights reserved.