Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example sets text for a combo box cell. When you press the button, additional items are added to the bottom of the list.

C++

CWnd::OnCreate()
{
// Specify a cell
m_Spread.SetCol(2);
m_Spread.SetRow(3);
// Define cell type as combo box
m_Spread.SetCellType(CellTypeComboBox);
// Add text to the combo box
m_Spread.SetTypeComboBoxList("Maple\tOak\tAsh");
}

CWnd::OnBtnClick()
{
// Return the total number of items in the combo box
init x;
x = m_Spread.GetTypeComboBoxCount;
// Insert text after the last item
m_Spread.SetTypeComboBoxIndex(x);
// Specify the text
m_Spread.SetTypeComboBoxString("Dogwood");
m_Spread.SetTypeComboBoxString("Pear");
}

Visual Basic

Sub Form_Load()
' Specify a cell
fpSpread1.Row = 3
fpSpread1.Col = 2
' Define cell type as combo box
fpSpread1.CellType = CellTypeComboBox
' Add text to the combo box
fpSpread1.TypeComboBoxList = "Maple" + Chr$(9) + "Oak"+ Chr$(9) + "Ash"
End Sub

Sub Command1_Click()
' Return the total number of items in the combo box
x = fpSpread1.TypeComboBoxCount
' Insert text after the last item
fpSpread1.TypeComboBoxIndex = x
' Specify the text
fpSpread1.TypeComboBoxString = "Dogwood"
fpSpread1.TypeComboBoxString = "Pear"
End Sub

Copyright © GrapeCity, inc. All rights reserved.