Search code examples
c#.netasp.netmschartmouseclick-event

how to check the click event handler for ms chart control


Hi I am using ms chart control in win-forms application.

I have a problem with mouse click event handler for chart control. I need to check that like this if the mouse click event for chart control is true then do something like this i have done the code like this

        bool this.kpiChartControl.MouseClick = false;


        if (this.kpiChartControl.MouseClick != true)
        {
                //do something.....
        }


   ERROR :  The event system.windows.forms.control.mouseclick can only appear on left hand side of += or -= 

would any one pls help on this.......

I need to check like this if mouse click event for mschart is true " do something "....

Modified code :

 this.kpiChartControl.MouseClick+= new MouseEventHandler(void (object , MouseEventArgs e))

still it was giving error can any help me on this...

MODIFIED CODE :

       if( this.kpiChartControl.MouseClick+= new MouseEventHandler(void (object  sender , MouseEventArgs e)) == true)
      {
         // do something

       }

Error :Invalid term Void


Solution

  • You need to register to the event; as such:

    this.kpiChartControl.MouseClick += (obj, sender) => { //Do something }

    See also: http://msdn.microsoft.com/en-us/library/aa645739(VS.71).aspx