开发者

function orderInfo.Selected is not regconized

I'm implementing the code from the book to create a customized action pane in Excel

using System;

using System.Data; using System.Drawing; using System.Windows.Forms; using Microsoft.VisualStudio.OfficeTools.Interop.Runtime; using Excel = Microsoft.Office.Interop.Excel; using Office = Microsoft.Office.Core;

namespace ExcelWorkbook1 { public partial class Sheet1 { public Button customerButton = new Button(); public Button inventoryButton = new Button();

private void Sheet1_Startup(object sender, EventArgs e)
{
  customerButton.Text = "Select a customer...";
  inventoryButton.Text = "Check inventory...";

  this.orderInfo.Selected +=
    new Excel.DocEvents_SelectionChangeEventHandler(
    OrderInfo_Selected);

  this.orderInfo.Deselected +=
    new Excel.DocEvents_SelectionChangeEventHandler(
    OrderInfo_Deselected);

  this.customerInfo.Selected +=
    new Excel.DocEvents_SelectionChangeEventHandler(
    CustomerInfo_Selected);

  this.customerInfo.Deselected +=
    new Excel.DocEvents_SelectionChangeEventHandler(
    CustomerInfo_Deselected);
}

#region VSTO Designer generated code
private void InternalStartup()
{
  this.Startup += new System.Event开发者_StackOverflowHandler(Sheet1_Startup);
}
#endregion

void OrderInfo_Selected(Excel.Range target)
{
  Globals.ThisWorkbook.ActionsPane.Controls.Add(inventoryButton);
}

void OrderInfo_Deselected(Excel.Range target)
{
  Globals.ThisWorkbook.ActionsPane.Controls.Remove(inventoryButton);
}

void CustomerInfo_Selected(Excel.Range target)
{
  Globals.ThisWorkbook.ActionsPane.Controls.Add(customerButton);
}

void CustomerInfo_Deselected(Excel.Range target)
{
  Globals.ThisWorkbook.ActionsPane.Controls.Remove(customerButton);
}

} }

However the code this.order.Selected' is not regconized Do you have any suggestion for me? Thanks


Do you have a named range in your Sheet1 with name orderInfo? If yes, is it generated in the code-behind? (Sheet1.Designer.cs)

Notice, that you misspeled the name of your member in the last sentence: should be 'this.orderInfo.Selected'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜