Hello i am trying to add a click event to chart points but i am getting the following Error when i click the chart "Object reference not set to an instance of an object"
here is my code
Private Sub Chart1_Click(sender As Object, e As System.EventArgs) Handles Chart1.Click
Try
Dim pointindex As Integer
If result.ChartElementType = ChartElementType.DataPoint Then
pointindex = result.PointIndex
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Form1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
result = Chart1.HitTest(e.X, e.Y)
End Sub