none
Error with event args RRS feed

  • Question

  • Does anyone have ideas on how to fix this error.  Thank you in advance.

     

     

    private void Map_Click(object sender, EventArgs e)

    {

    axMapControl1_OnMouseDown(sender, eventArgs);

    }

     

     

    Error 1 The name 'eventArgs' does not exist in the current context
    Monday, February 25, 2008 3:21 AM

Answers

  • Code Snippet

    private void Map_Click(object sender, EventArgs e)

    {

    axMapControl1_OnMouseDown(sender, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0);

    }


    Somethod like this should call the event handler with the correct parameter types.

    Monday, February 25, 2008 3:48 PM

All replies

  • Hi,

      e is the variable name not eventArgs, so:

     

    axMapControl1_OnMouseDown(sender, e);

     

     

    Mark

    Monday, February 25, 2008 3:25 AM
  • I tried the above suggestion but now have 2 errors.

     

    Error 1 The best overloaded method match for 'WindowsApplication5.Form1.axMapControl1_OnMouseDown(object, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent)' has some invalid arguments 


    Error 2 Argument '2': cannot convert from 'System.EventArgs' to 'ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent'

    Monday, February 25, 2008 4:06 AM
  • Okay, so you need to create an instance of the ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent type and then pass that in as a parameter to the axMapControl1_OnMouseDown method.

     

    Mark.

    Monday, February 25, 2008 5:09 AM
  •  

    The paramerter are you sending is EventArgs which is the parent of MouseEventArgs, so you can not send the EventArgs type parameter to MouseEventArgs without casting.
    Monday, February 25, 2008 6:50 AM
  • How is this done?

     

    Monday, February 25, 2008 3:17 PM
  • Code Snippet

    private void Map_Click(object sender, EventArgs e)

    {

    axMapControl1_OnMouseDown(sender, new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0);

    }


    Somethod like this should call the event handler with the correct parameter types.

    Monday, February 25, 2008 3:48 PM