Method does not have the same signature as delegate

Discussion in 'ASP .Net' started by vishakha.ganjoo@gmail.com, Sep 19, 2005.

  1. Guest

    ' C Sharp function - Start
    ' private void id_ok_Click(object sender, EventArgs e)
    '{
    ' try
    ' {
    ' _job = new
    OsaScanJob((OsaSessionState)Session[OsaSessionState.MFPSession]);
    ' _job.Create();
    ' _job.Completed += new
    Osa.BusinessObjects.Job.OsaJobCompleteEventHandler(job_Completed);

    ' _job.SetElements((Osa.Components.Metadata.MetadataCollection)Session["ScanSettingsMetadata"]);
    ' _job.Execute();
    ' }
    ' catch(Exception ex)
    ' {
    ' System.Diagnostics.Trace.Write("Error: " + ex.Message +
    "innerException: " + ex.InnerException + "Stack trace: " +
    ex.StackTrace);
    ' ShowTopLevelScreen();
    ' }
    '}
    ' C Sharp function - End

    Private Sub id_ok_Click(ByVal sender As Object, ByVal e As
    EventArgs)
    Try
    _job = New
    OsaScanJob(CType(Session(OsaSessionState.MFPSession), OsaSessionState))
    _job.Create()
    AddHandler _job.Completed, AddressOf Me.job_Completed
    _job.SetElements(CType(Session("ScanSettingsMetadata"),
    Osa.Components.Metadata.MetadataCollection))
    _job.Execute()
    Catch ex As Exception
    System.Diagnostics.Trace.Write("Error:" + ex.Message +
    "innerException:" + ex.InnerException.ToString() + "Stack trace:" +
    ex.StackTrace)
    ShowTopLevelScreen()
    End Try
    End Sub

    It is giving me an error stating
    Method 'Private Sub job_Completed(sender As Object, e As
    System.EventArgs)' does not have the same signature as delegate
    'Delegate Sub OsaJobCompleteEventHandler(sender As Object, e As
    Osa.BusinessObjects.Job.OsaJobCompleteEventArgs)'...

    Please let me know how can I rectify this error.
     
    , Sep 19, 2005
    #1
    1. Advertising

  2. Here is the issue:
    OsaJobCompleteEventArgs
    EventArgs

    You need to match by tweaking one side or the other. Either the event args
    in the delegate needs to be less specific or the handler needs to be more
    specific.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************


    "" wrote:

    > ' C Sharp function - Start
    > ' private void id_ok_Click(object sender, EventArgs e)
    > '{
    > ' try
    > ' {
    > ' _job = new
    > OsaScanJob((OsaSessionState)Session[OsaSessionState.MFPSession]);
    > ' _job.Create();
    > ' _job.Completed += new
    > Osa.BusinessObjects.Job.OsaJobCompleteEventHandler(job_Completed);
    >
    > ' _job.SetElements((Osa.Components.Metadata.MetadataCollection)Session["ScanSettingsMetadata"]);
    > ' _job.Execute();
    > ' }
    > ' catch(Exception ex)
    > ' {
    > ' System.Diagnostics.Trace.Write("Error: " + ex.Message +
    > "innerException: " + ex.InnerException + "Stack trace: " +
    > ex.StackTrace);
    > ' ShowTopLevelScreen();
    > ' }
    > '}
    > ' C Sharp function - End
    >
    > Private Sub id_ok_Click(ByVal sender As Object, ByVal e As
    > EventArgs)
    > Try
    > _job = New
    > OsaScanJob(CType(Session(OsaSessionState.MFPSession), OsaSessionState))
    > _job.Create()
    > AddHandler _job.Completed, AddressOf Me.job_Completed
    > _job.SetElements(CType(Session("ScanSettingsMetadata"),
    > Osa.Components.Metadata.MetadataCollection))
    > _job.Execute()
    > Catch ex As Exception
    > System.Diagnostics.Trace.Write("Error:" + ex.Message +
    > "innerException:" + ex.InnerException.ToString() + "Stack trace:" +
    > ex.StackTrace)
    > ShowTopLevelScreen()
    > End Try
    > End Sub
    >
    > It is giving me an error stating
    > Method 'Private Sub job_Completed(sender As Object, e As
    > System.EventArgs)' does not have the same signature as delegate
    > 'Delegate Sub OsaJobCompleteEventHandler(sender As Object, e As
    > Osa.BusinessObjects.Job.OsaJobCompleteEventArgs)'...
    >
    > Please let me know how can I rectify this error.
    >
    >
     
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Sep 19, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JJBW
    Replies:
    1
    Views:
    10,439
    Joerg Jooss
    Apr 24, 2004
  2. Wes Harrison
    Replies:
    6
    Views:
    901
    Oliver Fels
    Aug 3, 2004
  3. Gustavo Narea
    Replies:
    14
    Views:
    885
    Gustavo Narea
    Feb 16, 2009
  4. news.microsoft.com

    How to get the full signature of a delegate?

    news.microsoft.com, May 18, 2007, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    782
    Jon Skeet [C# MVP]
    May 18, 2007
  5. David Cho
    Replies:
    0
    Views:
    160
    David Cho
    Oct 10, 2003
Loading...

Share This Page