Default option for the DataSource property of a PivotTable is not displayed (820642)



The information in this article applies to:

  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# 2005, Express Edition
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

You have a Microsoft Windows Form that contains a PivotTable ActiveX control. When you try to set the DataSource property of the control in Windows Forms Designer, you notice that the default option is not displayed in the drop-down list of the DataSource property.

Note In Microsoft Visual Basic 6.0, the default options are displayed in the drop-down list of the DataSource property.

CAUSE

This behavior occurs because the PivotTable ActiveX control does not support early binding of data source in Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET. Therefore, the default option is not displayed in the drop-down list of the DataSource property in Windows Forms Designer.

WORKAROUND

To work around this behavior, set the DataSource property of the PivotTable control at runtime. To do this, follow these steps:
  1. Add the following code to the Load event of the Form1 form.

    Microsoft Visual Basic 2005 or Microsoft Visual Basic .NET code
    'Create an instance of the PivotTable control.
    Dim AxPivotTable2 As New AxOWC.AxPivotTable
    'Set the datasource property of the control to the default option.
    AxPivotTable2.DataSource = AxPivotTable2.GetOcx
    'Add the control to the form.
    Me.Controls.Add(AxPivotTable2)
    Microsoft Visual C# 2005 or Microsoft Visual C# .NET code
    //Create an instance of the PivotTable control.
    AxOWC.AxPivotTable AxPivotTable2 =new AxOWC.AxPivotTable();
    //Set the datasource property of the control to the default option.
    AxPivotTable2.DataSource = (msdatasrc.DataSource)AxPivotTable2.GetOcx();
    //Add the control to the form.
    this.Controls.Add(AxPivotTable2);
  2. On the Debug menu, click Start.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. In Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET, start a new Windows Application by using Visual Basic 2005, Visual Basic .NET, Visual C# 2005, or Visual C# .NET. By default, Form1 is created.
  2. On the Tools menu, click Customize Toolbox.

    Note In Microsoft Visual Studio .NET 2003, click Add/Remove Toolbox Items on the Tools menu. In Visual Studio 2005, click Choose Toolbox Items on the Tools menu..
  3. On the COM Components tab, select Microsoft Office PivotTable 9.0, Microsoft Office PivotTable 10.0, or Microsoft Office PivotTable 11.0, and then click OK.
  4. Add a PivotTable control to the Form1 form.
  5. Right-click AxPivotTable1, click Properties, and then click the DataSource property.

    In the DataSource property drop-down list, notice that the default option AxPivotTable1 is not available.

    Note In Microsoft Visual Basic 6.0, notice the default option (for example PivotTable1) in the drop-down list of the DataSource property.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005applies kbvs2005swept kbOfficeWebPivot kbProperties kbCtrl kbControl kbComCtrls kbWindowsForms kbPivotTable kbprb KB820642 kbAudDeveloper