1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

problem with Excel.AppEvents_SheetActivateEventHandler'

Discussion in 'C#' started by en0ne, Aug 2, 2008.

  1. en0ne

    en0ne New Member

    Joined:
    Jul 20, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Excel = Microsoft.Office.Interop.Excel;
    using System.Windows.Forms;
    
    namespace ConsoleApplicationProva1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Excel.Application thisApplication = new Excel.Application();
                thisApplication.Visible = true;
                thisApplication.StatusBar = "Enor";
                thisApplication.Workbooks.Add(System.Type.Missing);
                //
                thisApplication.SheetActivate += new Excel.AppEvents_SheetActivateEventHandler(thisApplication_SheetActivate);
            }
    
            void thisApplication_SheetActivate(object sender, Excel.Range target, ref bool cancel)
            {
                MessageBox.Show("Enor");
            }
        }
    }
    
    This code wich I found in e book fires error like below
    Error 1 No overload for 'thisApplication_SheetActivate' matches delegate 'Microsoft.Office.Interop.Excel.AppEvents_SheetActivateEventHandler' C:\Documents and Settings\Enor\My Documents\Visual Studio 2008\Projects\ConsoleApplicationProva1\ConsoleApplicationProva1\Program.cs 19 46 ConsoleApplicationProva1
    does anybody know how to deal with this?
    Thakns in advance
     

Share This Page