Represents a ComboBox that lets the user select a column from the group table.
Call ColumnComboBox.PopulateWithTableColumnNames to populate the ComboBox with the group table column names.
Inheritance: ColumnComboBox
コード例 #1
0
    InitializeGroupComboBoxes
    (
        Microsoft.Office.Interop.Excel.Workbook oWorkbook
    )
    {
        Debug.Assert(oWorkbook != null);

        m_aoGroupSourceColumnNameComboBoxes =
            new GroupColumnComboBox[]
            {
                cbxGroupCollapsedSourceColumnName,
                cbxGroupLabelSourceColumnName,
            };

        ListObject oGroupTable;

        if ( ExcelTableUtil.TryGetTable(oWorkbook, WorksheetNames.Groups,
            TableNames.Groups, out oGroupTable) )
        {
            // Populate the group table column ComboBoxes with the source
            // column names.

            foreach (GroupColumnComboBox oComboBox in
                m_aoGroupSourceColumnNameComboBoxes)
            {
                oComboBox.PopulateWithTableColumnNames(oGroupTable);
            }
        }

        // Store the name of the column corresponding to the ComboBox in each
        // ComboBox's Tag.  This gets used for error checking by
        // DoDataExchange().

        cbxGroupCollapsedSourceColumnName.Tag =
            GroupTableColumnNames.Collapsed;

        cbxGroupLabelSourceColumnName.Tag =
            GroupTableColumnNames.Label;
    }