您好,我正在尝试向图表点添加单击事件,但是当我单击图表“对象引用未设置为对象的实例”时出现以下错误
这是我的代码
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