Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a workbook with nine sheets. When the user scrolls through the sheets using the sheet tabs, the TabScrolled event occurs, and the old sheet and new sheet indices are displayed.

C++

BOOL CAboutDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    // Set number of sheets
m_Spread.SetSheetCount(9);
}

void CAboutDlg::OnTabScrollingFpSpread1(short OldLeftSheet, short NewLeftSheet)
{
    CString buffero;
    CString buffern;
    CString message;

    buffero.Format(_T("%x"), OldLeftSheet);
    buffern.Format(_T("%x"), NewLeftSheet);
    message =_T("Old ") + buffero + _T(" New ") + buffern;
    ::MessageBox(NULL, (LPCTSTR)message, "message body", MB_OK);
}

Visual Basic

Private Sub Form_Load()
    ' Set number of sheets
    fpSpread1.SheetCount = 9
End Sub

Private Sub fpSpread1_TabScrolling(ByVal OldLeftSheet As Integer, ByVal NewLeftSheet As Integer)
    ' Show sheet numbers in immediate window
    Debug.Print OldLeftSheet, NewLeftSheet
End Sub

Copyright © GrapeCity, inc. All rights reserved.