Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a recordset and binds it to a Spread control when the user clicks a button. The DataLoaded event puts text in a label to indicate the data has been loaded into the Spread control. The C++ example assumes you are working in Visual C++ and set up the data binding at design time.

C++

// Data binding was set at design time
void CDataBindingDlg::OnDataLoadedFpspread1()
{
    ::MessageBox(NULL, "Data Loaded", "message body", MB_OK);
}

Visual Basic

Private Sub Command1_Click()
    ' Create 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 fpSpread1_DataLoaded()
    Label1.Caption = "Data has been loaded"
End Sub

Copyright © GrapeCity, inc. All rights reserved.