Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# VSTO for Excel在C中用于设置和使用工作表更改事件的示例?_C#_Excel_Vsto - Fatal编程技术网

C# VSTO for Excel在C中用于设置和使用工作表更改事件的示例?

C# VSTO for Excel在C中用于设置和使用工作表更改事件的示例?,c#,excel,vsto,C#,Excel,Vsto,我正在尝试为私有void ThisAddIn_Startupobject发送方System.EventArgs e方法中的工作表更改事件连接事件处理程序 如果我接受使用tab键添加的条目,则会将以下行添加到private void ThisAddIn_Startupobject sender System.EventArgs e: 并增加了以下方法: private void ActiveWorksheet_Change(Excel.Range Target) { }

我正在尝试为私有void ThisAddIn_Startupobject发送方System.EventArgs e方法中的工作表更改事件连接事件处理程序

如果我接受使用tab键添加的条目,则会将以下行添加到private void ThisAddIn_Startupobject sender System.EventArgs e:

并增加了以下方法:

    private void ActiveWorksheet_Change(Excel.Range Target)
    {

    }
这将编译,但在以下位置引发异常:

activeWorksheet.Change += ActiveWorksheet_Change;
是否有关于使用VSTO和C将事件与Excel外接程序一起使用的示例参考


最近有没有关于使用VSTO和C的书籍?

请使用以下代码:

this.Application.SheetChange += Application_SheetChange; 

private void Application_SheetChange(object Sh, Excel.Range Target)
{
            // your code here
}
this.Application.SheetChange += Application_SheetChange; 

private void Application_SheetChange(object Sh, Excel.Range Target)
{
            // your code here
}